-
Notifications
You must be signed in to change notification settings - Fork 6k
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] supporting files like ApiClient cannot be generated because of bug in 2.4.6 #9540
Comments
Thanks @florimon for writing this up better than I could, I hope the team will add a regression test case for this, because this bug completely blew us out of the water also. |
I had a similar issue while using swagger-codegen-gradle, so this configuration: components = [apis: true, models: true, supportingFiles: true] Works on |
@florimon @chrisinmtown @carlosrogue Thanks a lot for the detailed info and for spotting the bug! it's indeed a regression, fixed in #9550, available in latest |
ref #9540 - fix regression in generate options
ref #9540 - fix generate option 3.0.0
Version |
Sorry to comment with a slightly unrelated question, however, could someone point me in the direction of the documentation for supporting files? I cannot find a reference to it anywhere! I have various classes that are not generated from the specification but I would like them generated alongside the rest of the library. An example is what @florimon mentioned, I have a entry point class ApiClient (.php in my case) and currently I've got a little bash script that does some find and replace with regex to put in some extra things related to the Api and Model classes generated |
Description
Due to a breaking change in 2.4.6 (compared to 2.4.5), generating supporting files like e.g. ApiClient.java that are necessary for producing a working client has become impossible.
Swagger-codegen version
version 2.4.6
Swagger declaration file content or url
any yaml (e.g. petstore).
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l java --library resttemplate -o ../petstore-server
Steps to reproduce
Related issues/PRs
none
Suggest a fix/enhancement
The problem is with the 2.4.6 version of io.swagger.codegen.DefaultGenerator#configureGeneratorProperties(), specifically line 138 (which was line 130 in 2.4.5).
Whereas the 2.4.5 version was setting the isGenerateSupportingFiles boolean flag to TRUE whenever a non-null system property "supportingFiles" existed, the 2.4.6 version only sets this flag to TRUE when that system property exists, AND is equal to (ignoring case) "true".
The problem with this, is that this system property serves a dual purpose - DefaultGenerator.generateSupportingFiles() interprets it as a comma separated 'whitelist' of supporting files to generate; lines 588 - 594 (of the 2.4.6 version) skip any file to be generated, if its name is not contained within this comma separated list.
So, setting -DsupportingFiles=true does not help in 2.4.6, since the whitelist will be "true" and of course no supporting files match that.
Fix/enhancement: either
The text was updated successfully, but these errors were encountered: