koshevy / codegena

Tools for codegeneration from OAS3 to TypeScript. Actual Roadmap published — https://github.com/koshevy/codegena/blob/codegena-3.x/ROADMAP.md
https://codegena-playground.stackblitz.io/
MIT License
38 stars 1 forks source link

Unexpected enum key type #10

Closed johnthecat closed 4 years ago

johnthecat commented 4 years ago

During integration we stuck on typescript convert step - method EnumTypeScriptDescriptor#_enumItemName (Go to) accepts only string, but in our case there is a number in some cases For example:

("paths" struct in OpenAPI v3 contract)

"/accounts/captcha": {
    "post": {
        "requestBody": {
            // skip
        },
        "responses": {
            "200": {
                "description": "Успех"
            },
            "409": {
                "content": {
                    "application/json": {
                        "schema": {
                            "status": {
                                "enum": [
                                    409 // <=========== this
                                ],
                                    "example": 409,
                                    "type": "integer"
                            },
                        },
                    }
                }
            },
        },
    },
}
koshevy commented 4 years ago

Fixed with new published version — https://github.com/koshevy/codegena/blob/master/libs/oapi3ts/CHANGELOG.md#214-2020-03-05