Closed ivansla closed 1 year ago
Probably I misunderstood the configuration. However, what I have noticed is in my logs:
[INFO] Inline schema created as Content_body. To have complete control of the model name, set the
titlefield or use the inlineSchemaNameMapping option (--inline-schema-name-mappings in CLI).
Basically what happens is, that codegen overwrites my ContentBody type, with inline schema Content_body. Once I added configuration, two classes were generated, original ContentBody and MyContentBody:
<inlineSchemaNameMappings>
Content_body=MyContentBody
</inlineSchemaNameMappings>
Not sure if this is a feature or bug, but it definitely got me perplexed. Maybe this default behavior of naming inline schema requires revision, one idea is to check whether similar type already exists.
I have mixed maven plugin. This solution is for: openapi-generator-maven-plugin
Description
Swagger codegen, doesn't generate correct ContentBody when using skipInlineModelMatches, or --flatten-inline-schema or --resolve-fully
However when I add
<modelsToGenerate>Content,ContentBody</modelsToGenerate>
to Maven configuration, it is correctly generated:Swagger-codegen version
version: 3.0.43
Swagger declaration file content or url
https://gist.github.com/ivansla/2463bdfeb866d8cc300091b8c2ce9b2f
Command line used for generation
In Maven:
<skipInlineModelMatches>true</skipInlineModelMatches>
In CLI: java -jar swagger-codegen-cli.jar generate -l java -i test.json -o ./target/java3/ --flatten-inline-schema java -jar swagger-codegen-cli.jar generate -l java -i test.json -o ./target/java3/ --resolve-fully
Java 11
Steps to reproduce
mvn clean verify, after the plugin is configured.
Related issues/PRs
I believe it is somewhat related to these issues: https://github.com/swagger-api/swagger-codegen/issues/4883 https://github.com/swagger-api/swagger-parser/issues/1158