Bug Report Checklist
Description
Enum values are generated incorrectly for PascalCase enum property naming type when the source enum values are in uppercase with underscores.
For example, original enum values:
"BookType": {
"type": "string",
"description": "Book Type",
"example": "SCIENCE",
"enum": [
"SCIENCE",
"SCIENCE_FICTION"
]
}
Expected enum values:
export enum BookType {
Science = 'SCIENCE',
ScienceFiction = 'SCIENCE_FICTION'
}
Actual enum values:
export enum BookType {
SCIENCE = 'SCIENCE',
SCIENCEFICTION = 'SCIENCE_FICTION'
}
openapi-generator version
5.0.0-SNAPSHOT
OpenAPI declaration file content or url
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "/"
}
],
"paths": {
"/books/{id}": {
"get": {
"tags": [
"controller"
],
"description": "Get book by ID",
"operationId": "getBookById",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/Book"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Book": {
"required": [
"id",
"type"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "ID",
"format": "uuid"
},
"type": {
"type": "string",
"description": "Book type",
"enum": [
"SCIENCE",
"SCIENCE_FICTION"
]
}
},
"description": "Book"
}
},
"securitySchemes": {
"basicScheme": {
"type": "http",
"scheme": "basic"
}
}
}
}
Generation Details
Generator: typescript-axios
Config options:
<configOptions>
<enumPropertyNaming>PascalCase</enumPropertyNaming>
</configOptions>
Steps to reproduce
This issue can be reproduced by using the typescript-axios generator with the OpenAPI declaration & config from above.
Related issues/PRs
Suggest a fix
Bug Report Checklist
Description
Enum values are generated incorrectly for PascalCase enum property naming type when the source enum values are in uppercase with underscores.
For example, original enum values:
Expected enum values:
Actual enum values:
openapi-generator version
5.0.0-SNAPSHOT
OpenAPI declaration file content or url
{ "openapi": "3.0.1", "info": { "title": "OpenAPI definition", "version": "v0" }, "servers": [ { "url": "/" } ], "paths": { "/books/{id}": { "get": { "tags": [ "controller" ], "description": "Get book by ID", "operationId": "getBookById", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Book" } } } } } } } }, "components": { "schemas": { "Book": { "required": [ "id", "type" ], "type": "object", "properties": { "id": { "type": "string", "description": "ID", "format": "uuid" }, "type": { "type": "string", "description": "Book type", "enum": [ "SCIENCE", "SCIENCE_FICTION" ] } }, "description": "Book" } }, "securitySchemes": { "basicScheme": { "type": "http", "scheme": "basic" } } } }Generation Details
Generator:
typescript-axiosConfig options:
Steps to reproduce
This issue can be reproduced by using the typescript-axios generator with the OpenAPI declaration & config from above.
Related issues/PRs
Suggest a fix