Description
Description
I can't tell which version specifically caused this regression because my project doesn't build on any versions in between 2.3.1 and 2.4.5.
Here is the spec where this occurs:
{
"info": {
},
"paths": {
"/user/email/v1": {
"post": {
"description": "email address",
"operationId": "post_user_email_v1",
"parameters": [
{
"description": "The future business user's email address. AdditionalProperties are allowed in order to accept utm_params",
"in": "body",
"name": "body",
"required": true,
"schema": {
"additionalProperties": true,
"properties": {
"enc_email_addr": {
"description": "An email address",
"type": "string"
},
"utm_campaign": {
"description": "(Optional) The campaign of the request, provided by the deep link URL",
"type": "string"
}
},
"required": [
"enc_email_addr"
],
"type": "object",
"x-model": "PostUserEmailV1_RequestData"
}
}
],
"responses": {
"200": {
"description": "A successful request will return a email address",
"examples": {
"application/json": {
"email": "[email protected]"
}
},
"schema": {
"additionalProperties": false,
"properties": {
"email": {
"description": "Email address",
"type": "string"
}
},
"required": [
"email"
],
"type": "object",
"x-model": "PostUserEmailV1_ResponseData"
}
},
"default": {
"description": "Error response",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
}
},
"produces": [
"application/json"
],
"schemes": [
"http"
],
"swagger": "2.0"
}
With the above example, the following are the contents of allDefinitions
in fromModel(name: String, model: Model, allDefinitions: MutableMap<String, Model>?): CodegenModel
2.3.1:
The request parameters model
The response parameters model
2.4.5:
The request parameters model
Removing "additionalProperties": false,
from the response schema "solves" the problem. This of course isn't a real solution, but it gets the response model included in allDefinitions
.
Swagger-codegen version
2.3.1 is the last working version. This bug still exists in 3.0.14. It was introduced some time between 2.3.1 and 2.4.5. It is a regression as far as I can tell.
Swagger declaration file content or url
See json above
Command line used for generation
We're using custom tooling on top of swagger-codegen. I can try and figure out what command ends up getting used if it would be helpful though.
Steps to reproduce
See above
Related issues/PRs
Similar issue from May. My issue adds the additional information that this behavior is a regression and which versions it may have been introduced in.
#9262
Suggest a fix/enhancement
See linked issue.