-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[JAVA-SPRING] Convert byte[] to String for operation params [QueryParam; PathParam; HeaderParam; CookieParam; FormParam] #22930
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
Open
Picazsoo
wants to merge
29
commits into
OpenAPITools:master
Choose a base branch
from
Picazsoo:feature/java-spring-convert-byte-array-operation-params-to-String
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
59bd0eb
convert byte[] to String for operation params
Picazsoo 78499b6
add unit tests
Picazsoo 02a530a
clean up open api spec
Picazsoo 8685cb9
fix CR suggestions
Picazsoo e78800b
add sample
Picazsoo 6e37d4e
add sample and fix log
Picazsoo e0d2d56
up-to-date
Picazsoo 4311007
remove typeMappping
Picazsoo 2e92477
fix implementation and tests
Picazsoo 49a9869
implement CR feedback
Picazsoo 1dc3a5c
fix test
Picazsoo a80c790
remove accidental change in kotlin tests
Picazsoo e1a47cb
remove extraneous file from kotlin open api specs
Picazsoo 8abc255
update samples
Picazsoo 08eee7f
update samples
Picazsoo 69ebc07
Merge branch 'master' into feature/java-spring-convert-byte-array-ope…
Picazsoo 2a4b8f2
update samples after merge of master
Picazsoo fd81045
update samples after merge of master
Picazsoo e6faab7
revert unrelated changes
Picazsoo c899cb4
fix reactive multipart
Picazsoo 6edb518
update samples
Picazsoo ef44359
add lambda to add the type comment conditionally.
Picazsoo 72337a5
delete old sample files
Picazsoo 281fa2a
fix test
Picazsoo 09bb69c
update samples
Picazsoo 60780a1
add api endpoint for tests and update samples
Picazsoo 879439e
update samples
Picazsoo 6170b60
update samples and add tests
Picazsoo 20a0ae2
fix test name
Picazsoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
2 changes: 1 addition & 1 deletion
2
modules/openapi-generator/src/main/resources/JavaSpring/cookieParams.mustache
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isCookieParam}} | ||
| {{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/isCookieParam}} |
2 changes: 1 addition & 1 deletion
2
modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}{{#reactive}}@RequestPart{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} | ||
| {{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}{{#reactive}}@RequestPart{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} |
2 changes: 1 addition & 1 deletion
2
modules/openapi-generator/src/main/resources/JavaSpring/headerParams.mustache
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{#isHeaderParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isHeaderParam}} | ||
| {{#isHeaderParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/isHeaderParam}} |
2 changes: 1 addition & 1 deletion
2
modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}} | ||
| {{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/isPathParam}} |
2 changes: 1 addition & 1 deletion
2
modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{#isQueryParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isQueryParam}} | ||
| {{#isQueryParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/isQueryParam}} |
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
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
171 changes: 171 additions & 0 deletions
171
modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| openapi: 3.0.3 | ||
| info: | ||
| title: Byte Format Edge Cases | ||
| version: 1.0.0 | ||
|
|
||
| paths: | ||
| /queryfdsfsd: | ||
| get: | ||
| operationId: queryParamsfdsfsfdsfs | ||
| summary: Query parametersfsdaf | ||
| parameters: | ||
| - name: plain | ||
| in: query | ||
| schema: | ||
| type: string | ||
|
|
||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /query: | ||
| get: | ||
| operationId: queryParams | ||
| summary: Query parameters | ||
| parameters: | ||
| - name: plain | ||
| in: query | ||
| schema: | ||
| type: string | ||
| - name: byte | ||
| in: query | ||
| schema: | ||
| type: string | ||
| format: byte | ||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /path/{plain}/{byte}: | ||
| get: | ||
| operationId: pathParams | ||
| summary: Path parameters | ||
| parameters: | ||
| - name: plain | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: string | ||
| - name: byte | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: string | ||
| format: byte | ||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /header: | ||
| get: | ||
| operationId: headerParams | ||
| summary: Header parameters | ||
| parameters: | ||
| - name: X-Plain | ||
| in: header | ||
| schema: | ||
| type: string | ||
| - name: X-Byte | ||
| in: header | ||
| schema: | ||
| type: string | ||
| format: byte | ||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /cookie: | ||
| get: | ||
| operationId: cookieParams | ||
| summary: Cookie parameters | ||
| parameters: | ||
| - name: plain | ||
| in: cookie | ||
| schema: | ||
| type: string | ||
| - name: byte | ||
| in: cookie | ||
| schema: | ||
| type: string | ||
| format: byte | ||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /form: | ||
| post: | ||
| operationId: formParams | ||
| summary: application/x-www-form-urlencoded | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/x-www-form-urlencoded: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| plain: | ||
| type: string | ||
| byte: | ||
| type: string | ||
| format: byte | ||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /multipart: | ||
| post: | ||
| operationId: multipartParams | ||
| summary: multipart/form-data | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| multipart/form-data: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| plain: | ||
| type: string | ||
| byte: | ||
| type: string | ||
| format: byte | ||
| file: | ||
| type: string | ||
| format: binary | ||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /json-body: | ||
| post: | ||
| operationId: jsonBody | ||
| summary: JSON request body | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| plain: | ||
| type: string | ||
| byte: | ||
| type: string | ||
| format: byte | ||
| responses: | ||
| '204': | ||
| description: No content | ||
|
|
||
| /binary-body: | ||
| post: | ||
| operationId: binaryBody | ||
| summary: Raw binary body | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/octet-stream: | ||
| schema: | ||
| type: string | ||
| format: binary | ||
| responses: | ||
| '204': | ||
| description: No content |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.