-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java][Spring] fix enum variables in path parameters which generated …
…allowableValues with double quote(#6762)
- Loading branch information
Yukai Lin
committed
Sep 1, 2021
1 parent
d9f36cd
commit c6d6809
Showing
4 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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/pathParams.mustache
This file contains 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}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambdaEscapeDoubleQuote}}{{{value}}}{{/lambdaEscapeDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}{{/isContainer}}) @PathVariable("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isPathParam}} | ||
{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambdaRemoveDoubleQuote}}{{{value}}}{{/lambdaRemoveDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}{{/isContainer}}) @PathVariable("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isPathParam}} |
This file contains 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
61 changes: 61 additions & 0 deletions
61
modules/openapi-generator/src/test/resources/3_0/issue_6762.yaml
This file contains 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,61 @@ | ||
openapi: 3.0.0 | ||
servers: | ||
- url: 'localhost:8080' | ||
info: | ||
version: 1.0.0 | ||
title: OpenAPI Zoo | ||
license: | ||
name: Apache-2.0 | ||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html' | ||
paths: | ||
/girafes/{refStatus}: | ||
get: | ||
operationId: getGirafes | ||
parameters: | ||
- $ref: '#/components/parameters/refStatus' | ||
/zebras/{status}: | ||
get: | ||
operationId: getZebras | ||
parameters: | ||
- in: path | ||
name: status | ||
required: true | ||
schema: | ||
type: integer | ||
enum: [0,1] | ||
default: 0 | ||
/bears/{refCondition}: | ||
get: | ||
operationId: getBears | ||
parameters: | ||
- $ref: '#/components/parameters/refCondition' | ||
/camels/{condition}: | ||
get: | ||
operationId: getCamels | ||
parameters: | ||
- in: path | ||
name: condition | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- sleeping | ||
- awake | ||
components: | ||
parameters: | ||
refStatus: | ||
in: path | ||
name: refStatus | ||
required: true | ||
schema: | ||
type: integer | ||
enum: [0,1] | ||
default: 0 | ||
refCondition: | ||
in: path | ||
name: refCondition | ||
schema: | ||
type: string | ||
enum: | ||
- sleeping | ||
- awake |