-
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
[Spring] The java8 parameter is ignored, always behaves as true #5614
Comments
@ebautistabar thanks for reporting the issue. Seems like
May I know if you've time to contribute the fix to hide the Java8 default interface using |
Sure, I'll try to fix it @wing328 |
The java8 parameter was used both signal use of the default interface and to signal general use of Java8, e.g. when the Java8 date libraries were used. Now we use a different parameter to signal use of the default interface: defaultInterface. Java8 is considered in use when either the default interface or the Java8 date libraries are used.
@wing328 The
Whenever a user selects Java 8 date libraries, the generator considers that Java 8 must be used and sets The fact that A possible solution is changing the name of the parameter in the Spring generator to something other than If we want to have the option of, e.g. setting Java 8 in the POM file but using Joda or legacy date libraries and without default interfaces, there is another option: keeping the existing Some questions:
|
It should be done against 2.3.0 since it's a breaking change.
To me, this is more preferable as developers who have been using the |
See #4854 . It may have already been done in 2.3.0. |
@cbornet I've looked at that PR and I'm not sure it solves the issue completely. It doesn't set the I would suggest someone with more experience than me with this code to look thoroughly at it to ensure the current state and the correct way to proceed. |
@ebautistabar I did a review and the Java8 option is set correctly: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java#L142-L144 Then I added I would suggest you to clone the swagger-codegen repo again and give it another try with the 2.3.0 branch. |
@wing328 I performed the following test today. I lay out here the steps for reproducibility and in case I'm doing something wrong.
Note that in all the commands I set both the dateLibrary and java8 properties. Now that we have the three versions (with default java8, with explicit java8=true and with explicit java8=false), compare each pair of folders with a diff tool. The result is that they are all the same. The expectation is that using different parameters will result in different output. |
Hi, I want to use java8-localdatetime too, but my feign client contains default interface, is this bug fixed on 3.0.0-RC? Thanks! |
Same issue using swagger-codegen v2.3.2 after converting dateLibrary to java8-localdatetime for my API. Looks like this was discussed on issue #3408 and again on #4854. The proposal on the latter looks like it got rejected and the issue is still open with the current target being v3.0.0. Can anyone confirm? Thanks. |
hey, thanks - thats excactly the (weird) commandline option i was looking for! |
Description
The java8 parameter in the spring generator is ignored, always behaves as true. It doesn't matter that it's specified explicitly or not. The generated code always contains Java 8
default
interfaces.Swagger-codegen version
Latest from master.
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i swagger.json -l spring -o build -D hideGenerationTimestamp=true --invoker-package custom.package --model-package custom.package.model --api-package custom.package.api --additional-properties dateLibrary=java8-localdatetime,basePackage=custom,configPackage=custom.swagger,useBeanValidation=true,java8=false
Steps to reproduce
Execute the given command with any valid JSON file.
Suggest a Fix
I guess the issue is in the
SpringCodegen.java
, but haven't checked thoroughly.The text was updated successfully, but these errors were encountered: