Hi.
I am using a typescript-axios generator. I have a problem with the Model for composed schemas.
Imagine openapi.yml has the below content:
Item:
type: object
properties:
id:
type: string
attributes:
oneOf:
- $ref: "#/components/schemas/ItemAttributes"
- $ref: "#/components/schemas/Brand"
Generator config:
"generator-cli": {
"version": "6.6.0",
"useDocker": false,
"generators": {
"typescript-axios": {
"generatorName": "typescript-axios",
"additionalProperties": {
"modelPackage": "model",
"modelNameSuffix": "Model",
"apiPackage": "api",
"apiNameSuffix": "Api",
"supportsES6": true,
"withSeparateModelsAndApi": true
},
}
}
}
as It shows we may have 2 models ItemAttributesModel based on #/components/schemas/ItemAttributes and BrandModel based on #/components/schemas/Brand.
On the other hand, since Item.attributes has oneOf props then the openapi-generator generates a new model for it through the combination of Item + attributes (ItemAttributesModel). So due to the ItemAttributesModelis existed before then, the generation fails.
I have tested with version 5.4.0 and there is no problem in 5.4.0. because in version 6.0.0 and above, it generates a new model for oneOf but in version 5.4.0 it doesn't generate a new model for this situation and uses UNION TYPE like: ItemAttributesModel | BrandModel.
The main question is, how can disable this feature added in version 6.0.0 in order to use UNION TYPE instead of generating new model?
openapi-generator version
6.6.0
Hi.
I am using a typescript-axios generator. I have a problem with the Model for composed schemas.
Imagine openapi.yml has the below content:
Generator config:
as It shows we may have 2 models
ItemAttributesModelbased on#/components/schemas/ItemAttributesandBrandModelbased on#/components/schemas/Brand.On the other hand, since
Item.attributeshasoneOfprops then the openapi-generator generates a new model for it through the combination ofItem+attributes(ItemAttributesModel). So due to theItemAttributesModelis existed before then, the generation fails.I have tested with version
5.4.0and there is no problem in5.4.0. because in version6.0.0and above, it generates a new model foroneOfbut in version5.4.0it doesn't generate a new model for this situation and usesUNION TYPElike:ItemAttributesModel | BrandModel.The main question is, how can disable this feature added in version 6.0.0 in order to use UNION TYPE instead of generating new model?
openapi-generator version
6.6.0