Bug Report Checklist
Description
Incorrect generation of model for boolean enum type. It is similar problem to linked similar issue/pr. I know the schema is strange but I have no control over it.
openapi-generator version
latest docker image, 6.6.0-SNAPSHOT at the time of writing
OpenAPI declaration file content or url
{
"swagger": "2.0",
"info": {
"title": "",
"version": ""
},
"host": "test.com",
"basePath": "/api",
"paths": {},
"definitions": {
"Commodity": {
"type": "object",
"properties": {
"active": {
"type": "boolean",
"format": "boolean",
"enum": [
"true",
"false"
]
}
}
}
}
}
Generation Details
Config can be seen below. Generated output creates:
/**
* @export
* @enum {string}
*/
export enum CommodityActiveEnum {
TRUE = true,
FALSE = false
}
which is incorrect. Should be smth like type = true | false or normalize to strings
Steps to reproduce
- Create some dir for docker volume with
config.yaml, schema.yaml (content above), and generate.sh script (or run inline)
#!/bin/bash
VOLUME_PATH=...
docker run --rm \
-v "${VOLUME_PATH}":/openapi openapitools/openapi-generator-cli generate \
-i /openapi/schema.yaml \
-g typescript-axios \
-o /openapi/output" \
-c /openapi/config.yaml \
--skip-operation-example
config.yaml:
snapshot: false
supportsES6: true
allowUnicodeIdentifiers: true
apiPackage: api
modelPackage: model
withSeparateModelsAndApi: true
enumPropertyNaming: UPPERCASE
stringEnums: true
useSingleRequestParameter: true
- run
./generate.sh
Related issues/PRs
Related to #9024
Suggest a fix
Bug Report Checklist
Description
Incorrect generation of model for boolean enum type. It is similar problem to linked similar issue/pr. I know the schema is strange but I have no control over it.
openapi-generator version
latest docker image,
6.6.0-SNAPSHOTat the time of writingOpenAPI declaration file content or url
Generation Details
Config can be seen below. Generated output creates:
which is incorrect. Should be smth like
type = true | falseor normalize to stringsSteps to reproduce
config.yaml,schema.yaml(content above), andgenerate.shscript (or run inline)config.yaml:
./generate.shRelated issues/PRs
Related to #9024
Suggest a fix