You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
A component defined in the API specification which is defined as a allOf of a single $ref which is a simple data type model gets generated as an interface{} instead of the correct type.
The same happens if the model is nullable, in which case the field is defined as an unexistent NullableInterface type.
openapi-generator version
OpenAPI declaration file content or url
schema.components block
"AllOfComponent": {
"allOf": [
{
"$ref": "#/components/schemas/SimpleStringModel"
}
],
"description": "The gateway of a network. If not specified the first ip of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway."
},
"SimpleStringModel": {
"type": "string"
},
"Body": {
"properties": {
"someField": {
"$ref": "#/components/schemas/AllOfComponent"
},
"type": "object"
},
Bug Report Checklist
Description
A component defined in the API specification which is defined as a
allOf
of a single $ref which is a simple data type model gets generated as aninterface{}
instead of the correct type.The same happens if the model is
nullable
, in which case the field is defined as an unexistentNullableInterface
type.openapi-generator version
OpenAPI declaration file content or url
schema.components block
Generation Details
Generation call:
java -Dlog.level=${LOG_LEVEL} -jar ${PATH} generate \ --generator-name go \ --input-spec ${JSON_SPEC} \ --enable-post-process-file \ --global-property apis,models,modelTests=true,modelDocs=false,apiDocs=false,supportingFiles \ --additional-properties=isGoSubmodule=true,enumClassPrefix=true
Generated model:
Related issues/PRs
Might be related to #17534
Suggest a fix
The generated model should have the type of the simple data type model that is being referenced, in this case
string
The text was updated successfully, but these errors were encountered: