Skip to content

Conversation

@y-higuchi
Copy link
Contributor

PR checklist

  • Read the contribution guildelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

JSON representation of model object, which had field with all capitals, resulted in same field content getting outputted twice in 2 different capitalization form.

This patch add @JsonProperty annotation to the template for getter to avoid them.
Also added model object to petstore-with-fake-endpoints-models-for-testing.yaml
and unit test CapitalizationTest.java to high light the issue.

I should've searched thoroughly before working on it,
but I've found #4066 which seems to be reporting same problem,
which proposes a fix in a different way.

Since this effective part of this patch is template only,
I'm using this version of template with swagger-codegen-maven-plugin 2.2.1,
specifying templateDirectory and additional-properties, jackson=true to configOptions.
So I thought it might be worth submitting PR anyways.

@wing328
Copy link
Contributor

wing328 commented Jan 10, 2017

@y-higuchi thanks for the fix and the additional test cases to cover it moving forward.

@wing328 wing328 merged commit de5ea8a into swagger-api:master Jan 10, 2017
@wing328 wing328 changed the title [JAX-RS/jersey2] Fix for incorrect JSON field name capitalization [JAX-RS][Jersey2] Fix for incorrect JSON field name capitalization Feb 21, 2017
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
…agger-api#4458)

* Fix for all capital field name

* Cosmetic: remove trailing spaces

* Adding ./bin/jaxrs-petstore-server.sh output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants