Open edrevo opened 7 years ago
If a referenced model is not used as response in the swagger json it will not be loaded in the definitions object of swagger.
So, in line 1359 from DefaultCodegen, the interfaceModel will be set as null, so the properties will not be set in our child model. (lines 1370 to 1375).
Still, the model will be imported on line 1369.
Eventually, this bug comes from the Swagger Parser. Open issue on https://github.com/swagger-api/swagger-parser/issues/494
PR done on swagger parser https://github.com/swagger-api/swagger-parser/pull/495#partial-pull-merging
When the merge is done, the new version should be added to the swagger codegen and it will fix this bug
The PR have been merged on the swagger-parser project so it means that when you add the last jar as dependency the bug will be fixed. As soon as the last version will be available I will test it.
Description
We have bumped into a situation where a model ends up as an import to another model, but it does not show up in the list of
CodegenModels
. This happens because one of our models is anallOf
which references a model calledModelError
, butModelError
is not directly used anywhere in our api definition.In the example below,
ModelError
ends as an import forInvalidArgument
, butModelError
is not in the list of models.I am tagging this as Java-Playframework because that's where I've seen the error surface, but it looks to me like a problem in
DefaultCodegen
Swagger-codegen version
2.3.0-SNAPSHOT
Swagger declaration file content or url
File 1:
File 2: