Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java][client] Fix regression in Java XML serialization #4023

Merged
merged 2 commits into from
Oct 7, 2019

Conversation

bkabrda
Copy link
Contributor

@bkabrda bkabrda commented Oct 2, 2019

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.
  • Filed the PR against the correct branch: master, 4.1.x, 5.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

CC @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04)

Description of the PR

Fixes regression reported in #4014.

@RockyMM since the current test cases don't cover this, could you try to grab this patch and verify that it fixes the regresssion? Thanks!

@RockyMM
Copy link
Contributor

RockyMM commented Oct 2, 2019

I have two points:

  1. this change needs to be propagated to all pojo.mustache in other Java-based generators :( (I was expecting some inheritance, but seems it needs to be copied manually to JAX-RS, Spring and the likes)

  2. this segment

    {{#jackson}}
    public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}";
    {{/jackson}}

also needs to be moved up.

@bkabrda
Copy link
Contributor Author

bkabrda commented Oct 2, 2019

So I moved the jackson's JSON_PROPERTY_* declaration as well, which should solve the second point. I honestly have no idea why this is a problem in all the other pojo templates, as I didn't touch them in my original PR that seemed to have caused this. Perhaps the issues with these were caused by different PRs?

@bkabrda
Copy link
Contributor Author

bkabrda commented Oct 2, 2019

I think the commit 1ab7b9c might have broken the other POJOs. I can try to fix that, but I'd prefer not mixing it with this PR, as the offending commits are different and this PR is for java clients.

@bkabrda bkabrda changed the title Fix regression in Java XML serialization. Fixes #4014 [java][client] Fix regression in Java XML serialization. Fixes #4014 Oct 2, 2019
@RockyMM
Copy link
Contributor

RockyMM commented Oct 4, 2019

Hm, in commit 1ab7b9c I checked the sample of Animal.java in "withXml" resttemplate example and it looked fine. So it might be that this is all the fix that we need.

It's interesting that when you've moved the jacksons JSON_PROPERTY_* that the generated samples also changed. I'm just getting a hold in this project so everything is new to me 😄

This means it is possible to write some automated tests for this so this won't appear again. Like check what is marshalled, and what is unmarsahlled and compare. I could help with this next week, but I think it is not really a show-stopper for the time being.

Update: I just saw #689 - I think it's very good idea. 👍

@wing328
Copy link
Member

wing328 commented Oct 7, 2019

This means it is possible to write some automated tests for this so this won't appear again. Like check what is marshalled, and what is unmarsahlled and compare. I could help with this next week, but I think it is not really a show-stopper for the time being.

Yes, we welcome additional unit tests to ensure this issue won't happen again.

@wing328
Copy link
Member

wing328 commented Oct 7, 2019

@RockyMM thanks for reviewing the fix.

@wing328 wing328 merged commit 5234139 into OpenAPITools:master Oct 7, 2019
@wing328 wing328 changed the title [java][client] Fix regression in Java XML serialization. Fixes #4014 [java][client] Fix regression in Java XML serialization Oct 30, 2019
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.

3 participants