We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The kotlin-spring generator does not add beanValidation annotations (e.g. @Max) for RequestBody params.
@Max
7.0.1
paths: /add: put: requestBody: content: application/json: schema: type: integer title: quantity minimum: 2 required: true responses: '204': description: OK
generates
@RequestMapping( method = [RequestMethod.PUT], value = ["/add"], produces = ["application/json"], consumes = ["application/json"] ) fun add(@Valid @RequestBody body: kotlin.Int): ResponseEntity<Unit>
but should have @Min(2) included:
@Min(2)
fun add(@Valid @Min(2) @RequestBody body: kotlin.Int): ResponseEntity<Unit>
Plugin configuration: (beanValidation is enabled by default)
generatorName = 'kotlin-spring' configOptions = [ interfaceOnly: 'true', skipDefaultInterface: 'true', useSpringBoot3: 'true' ]
./gradlew openApiGenerate
The same issue occurred and has been fixed in the java spring generator: #13932
Applying the same fix as done in #13932 for the java spring version.
The text was updated successfully, but these errors were encountered:
Hi, I try to fix it in #16859
Sorry, something went wrong.
add kotlin-spring beanValidation for RequestBody parameters fix #16738 (
ced31f4
#16859) * fix missing bean validation annotations on RequestBody * add new line to files * remove new line from files * reformat file
Successfully merging a pull request may close this issue.
Description
The kotlin-spring generator does not add beanValidation annotations (e.g.
@Max
) for RequestBody params.openapi-generator version
7.0.1
OpenAPI declaration file content or url
generates
but should have
@Min(2)
included:Generation Details
Plugin configuration: (beanValidation is enabled by default)
generatorName = 'kotlin-spring'
configOptions = [
interfaceOnly: 'true',
skipDefaultInterface: 'true',
useSpringBoot3: 'true'
]
Steps to reproduce
./gradlew openApiGenerate
Related issues/PRs
The same issue occurred and has been fixed in the java spring generator: #13932
Suggest a fix
Applying the same fix as done in #13932 for the java spring version.
The text was updated successfully, but these errors were encountered: