Open jordanwalsh23 opened 4 years ago
Please note this is also an issue when there is only a single letter prior to the underscore.
E.g. the bug is also present here in a field called x_links
, but it works perfectly with fields called xx_links
.
We have seen this too. Looks like the bug is actually in Springfox. Note that Springfox also doesn't support OpenAPI 3.0, so code generated from OpenAPI 3.0 works correctly, but presents a 2.0 rendition of the API on the swagger documentation page.
I have a similar issue. In #4805 there is an attemp to fix, maybe exposing a property like modelPropertyNaming=original
for java may help in that case ? Thanks
Hi, any update/workaround on this? I ran into this problem. If your field has an underscore, the output model would look like this:
@JsonProperty("_link")
private ResultLink _link = null;
This would give me a duplicate field, the one with the underscore and the other without.
But if I would change the private variable to just link
(retain the JsonProperty to use '_link'):
@JsonProperty("_link")
private ResultLink link = null;
This would not give me a duplicate fields.
Description
When generating spring code using swagger-codegen-cli, fields starting with an _ appear in the generated response twice.
Swagger-codegen version
swagger-codegen-cli v3.0.18
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
mvn clean install
java -jar target\my-jar-file.jar
_links
will be present, but also another variable will be present in the response calledlinks
.e.g.
Related issues/PRs
Can't find any.
Suggest a fix/enhancement
I've reviewed the generated code and can't see this extra parameter in any of the models. It seems to be within the core swagger codegen project.