ardatan/feTS

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

EricSmekens opened this issue · 0 comments

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