[Java][Jaxrs-Resteasy] Fixes generator devaultValues for int64/float/…#8988
Merged
wing328 merged 12 commits intoOpenAPITools:masterfrom Mar 24, 2021
Merged
[Java][Jaxrs-Resteasy] Fixes generator devaultValues for int64/float/…#8988wing328 merged 12 commits intoOpenAPITools:masterfrom
wing328 merged 12 commits intoOpenAPITools:masterfrom
Conversation
Contributor
Author
|
@wing328 Not sure how to assign this PR to you but please take a look, thanks |
wing328
reviewed
Mar 18, 2021
modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/PostProcessUtils.java
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@wing328 It seems the build keeps failing due to the docker pull limit Any thing we can do to let it pass? |
wing328
reviewed
Mar 23, 2021
modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/PostProcessUtils.java
Outdated
Show resolved
Hide resolved
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #8986
That issue describes that when we have an in64, float, or double CodegenParameter, the string defaultValue includes unneeded suffix characters l,f, or d. Those suffixes were added by AbstractJavaCodegen because that generator assumed that those default values would be used as java values of the correct type. Instead, the spring generator uses String type default values for CodegenParameter only. Typically those values are handled with parseLong/parseFloat/parseDouble etc which fail if the value includes a character suffix.
we now use values which lack the suffix so parseLong/parseDouble/parseFloat will work
CodegenParameter defaultValues:
"21474836487" (int64)
"3.14159" (float)
"3.14159" (double)
Verification Test
A test has been added at https://github.com/OpenAPITools/openapi-generator/pull/8988/files#diff-ecbab4cf643943739b9ce7e56d73b1b391b4ce6d09310326e8ea9d023da164b8R41