[Kotlin][Spring] fix option useSpringBuiltInValidation not implemented

Merged
WI
5mo ago
+114-0

based on https://github.com/OpenAPITools/openapi-generator/pull/23951 with updated doc, bug fix.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    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*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Fixes the kotlin-spring generator so useSpringBuiltInValidation disables class-level @Validated on generated controllers and interfaces when useBeanValidation is on. Default behavior is unchanged.

  • Bug Fixes
    • Wired the option in KotlinSpringServerCodegen (flag, CLI switch, processOpts/writePropertyBack).
    • Updated api.mustache and apiInterface.mustache to skip the import and annotation when enabled.
    • Added tests for interface/controller and default/true/false cases.
    • Documented the option in docs/generators/kotlin-spring.md.