Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response type is set to never when using exclusiveMinimum: true or exclusiveMaximum: true #1203

Open
EricSmekens opened this issue Feb 28, 2024 · 0 comments

Comments

@EricSmekens
Copy link

EricSmekens commented Feb 28, 2024

Describe the bug

When you're using exclusiveMinimum: true or exclusiveMaximum: true in your OpenAPI schema:

  • RequestBody will be completely ignored by the feTS client, as if it does not exist.
  • Response type will be set to never.

To Reproduce
Use exclusiveMinimum: true or exclusiveMaximum: true in your schema and generate a client.

This can be done by for example changing a current example in the repo, and add a property like this to the request or response:

"test": {
    "type": "number",
    "minimum": 0,
    "exclusiveMinimum": true,
    "maximum": 50
}

Or you can use the following:
I've tried to make a simple schema for it to trigger:
OpenAPI schema:

{
    "openapi": "3.0.3",
    "info": {
        "title": "Minmaxtest",
        "description": "Minmaxtest",
        "version": "0.1.0"
    },
    "components": {
        "securitySchemes": {
            "basicAuth": {
                "type": "http",
                "scheme": "basic"
            }
        },
        "schemas": {}
    },
    "paths": {
        "/minmaxtest": {
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "sequence": {
                                        "type": "integer",
                                        "exclusiveMinimum": true,
                                        "minimum": 0
                                    }
                                },
                                "required": [
                                    "sequence"
                                ],
                                "additionalProperties": false
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "201": {
                        "description": "Default Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "sequence": {
                                            "type": "integer",
                                            "exclusiveMinimum": true,
                                            "minimum": 0
                                        }
                                    },
                                    "required": [
                                        "sequence"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Expected behavior

I would not mind to ignore these fields, but currently it results in incorrect typing.

Environment:

  • OS: Windows 11
  • fets: 0.7.1
  • NodeJS: 18.19.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant