[JAVA][native] import the auto generated supporting JSON class only when discriminator is needed#8554
Conversation
Sync with master
Sync with master
Sync with master
…ss only when generateSupportingFiles is true
…ss only when generateSupportingFiles is true
…ss only when generateSupportingFiles is true
…JSON class only when generateSupportingFiles is true" This reverts commit 56e2b1f
…JSON class only when generateSupportingFiles is true" This reverts commit 335c304
|
@bgong-mdsol @bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @nmuesch @spacether @jimschubert mentioning the technical committee as requested and the last modifier of the template file. Please review. Thanks in advance. |
|
The import looks unused for the simple models so it may be just removed. |
|
Thanks, @Zomzog . If If so, isn't removing the If |
|
cc @OpenAPITools/generator-core-team |
What I think is you can just remove it from the model.mustache without any condition. |
|
@Zomzog OK. Thanks for the review! I'll remove the |
…ss only when generateSupportingFiles is true
|
@Zomzog For example, |
|
Ok, in this case maybe the import condition may be done like I'm not sure it's really useful to try to remove this import because most of the supporting files must be generated or provided in one way or another. Does this one really create an issue in particular cases? |
|
Thanks, @Zomzog . That is a good observation. There is a I'm guessing one approach is to make the supporting files list as minimal as possible. For example: In my case, I don't want and don't need the supporting files. I just want to generate model classes as POJOs. In my case, my auto generated model classes are not using the JSON class at all so I don't need the supporting files and all the dependencies. I want to be able to share and use the "model classes" in other use cases (e.g., sending them in a queue) and I want the receiving end to be able to depend on the "model classes" jar without too many unnecessary dependencies. I will try your suggestion with the |
…ss only when discriminator is needed
…ss only when discriminator is needed
There was a problem hiding this comment.
I think you can remove this line.
…ss only when discriminator is needed
|
Tested locally and no issue found. I found some warnings though: Will open an issue to track to see if anyone from the community can help fix these warnings. |
|
@MosheElisha thanks for the PR, which has been included in the v5.1.0 release: https://twitter.com/oas_generator/status/1373636654024380423 |
Import the auto generated supporting JSON class only when generateSupportingFiles is true.
Closes #8027
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master,5.1.x,6.0.x