-
Notifications
You must be signed in to change notification settings - Fork 6k
[Java] Fix issue when the swagger model contains an 'Object' class #4695
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
Conversation
If the swagger model contains a class named 'Object' some mustache templates will generate non compiling **Java** code.
|
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/swagger-api/swagger-codegen/graphs/contributors. Let me know if you need help fixing it. |
|
@wing328 I didn't see that, it is now Thanks ! |
|
cc @nickcmaynard @jfiala as the PR impacts JAX-RS generators. |
|
@wing328 looks good after quick inspection (I didn't run it), interesting issue... |
|
Needs sample updates, but this looks like a pragmatic solution to the problem. Might be worth a comment in the mustache files to explain why java.lang.Object to avoid regression later. Would a test case be possible? |
|
@nickcmaynard It fails at compile time, a test case would be possible if you generate the code and try to compile it. You might want to take a look at : https://commons.apache.org/proper/commons-jci/ You can do something like this:
If there's a regression, the test will fail for sure! |
|
I'll add a test object named "Object" to https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml#L902 so as to catch the issue moving forward. Will update the sample later. |
|
@imclem PR merged into master. Thanks for your contribution. For your upcoming PRs, please create a new branch for the change. |
|
Created #4782 for tracking |
…api#4695) If the swagger model contains a class named 'Object' some mustache templates will generate non compiling **Java** code.
This commit fixes the Java problem related by this defect #2064.
If the swagger model contains a class named 'Object' some mustache templates
will generate non compiling Java code.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)2.3.0branch for breaking (non-backward compatible) changes.Description of the PR
(details of the change, additional tests that have been done, reference to the issue for tracking, etc)