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] Handling optional query param #7115

Open
ukeshava opened this issue Dec 5, 2017 · 1 comment
Open

[Java] Handling optional query param #7115

ukeshava opened this issue Dec 5, 2017 · 1 comment

Comments

@ukeshava
Copy link

ukeshava commented Dec 5, 2017

We have codegen(2.2.2) to generate java client code for our tests. In a recent change, an optional query parameter was added to one of the APIs with default value specified.

This shouldn't cause any issue as its optional and also has default value, so it does support backward compatibility. However, the generated code changed the method signature from:

apirequest(param1)

to apirequest(param1, param2) - where param2 is optional and has default value defined

In our tests, it was calling apirequest(param1) which caused tests to break as there was now mismatch in no. of params for the method causing compile error.

I tried using useOptional=true in additional properties and set datatype for optional param to Optional, did not help - generated same method with no change in signature.

Tried upgrading to 2.2.3, but it crashed while processing some of the APIs where body param is List I see it fixed as issue #6079 (e8bdf71#diff-0c1b6d04d7c2c41f87f7c710a5610d88) but is not yet available. Temporarily tried setting to String in such cases, just to see if it helps the actual problem, the generated method still remained same with 2 params causing test to fail.

Not sure about how we can overcome this situation, so as not to break our tests with addition of optional parameter. Any suggestions/pointers would be of real help

@vinay36999
Copy link

Compilation is failing for me too because of this issue.
Looking for any suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants