-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Bug][Java] defaultValues for date and date-time params #11536
[Bug][Java] defaultValues for date and date-time params #11536
Conversation
...es/client/petstore/spring-cloud-date-time/src/main/java/org/openapitools/api/DefaultApi.java
Outdated
Show resolved
Hide resolved
...es/client/petstore/spring-cloud-date-time/src/main/java/org/openapitools/api/DefaultApi.java
Outdated
Show resolved
Hide resolved
@wing328 FYI. Who could help with the defaultValue date format issue? |
Is Line 896 in 9e1972b
I think you will need to override this method in the spring generator to address the issue above. |
Is stumbled up this line: Line 984 in 9e1972b
What is the reasoning behind that? |
@wing328 The result of toDefaultValue is ignore for all parameter type other than queryParams. Why is that? Any hint? |
Answer to self: probably used to generate Model classes, not for Api method Parameter. |
Relates to #8577 |
This reverts commit 2e37411.
# Conflicts: # samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeApi.md # samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeApi.java
Slowly getting there. Need to find out why application/x-www-form-urlencoded are treated like model parameter. |
@wing328 I added some more tests to cover this issue. BTW, I think it might be okay to move org.openapitools.codegen.languages.AbstractJavaCodegen#toDefaultParameterValue to DefaultCodegen. WDYT? |
Surprisingly there are no samples affected by the last changes. Should I add date params with defaults to the more widely used examples? |
I did (local only). We would see stuff like the following (a groovy example)
so obviously the code in toDefaultValue() is not capable of supporting multiple Date libraries. |
Ich enhanced @wing328 I'm happy with the PR, please review. |
cc @OpenAPITools/generator-core-team as the change covers default codegen: https://github.com/OpenAPITools/openapi-generator/pull/11536/files#diff-3a138675e8cb40943bcb00feb46edd6f6ee5c5306c29cc19f02c845a299c8658R6289 |
Support default values for Header and Cookie Params.
Fixes
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.3.0),6.0.x