[Kotlin][Spring] fix option `useSpringBuiltInValidation` not implemented

Closed
TO
5mo ago
+108-12

fixes #23950

Java Spring generator introduced option useSpringBuiltInValidation to address new Spring Framework 6.1+ controller argument validation mechanism.

This option is also present in Kotlin Spring generator documentation, however it seems like it has never been implemented and has no effect.

This PR ports the mechanism used in Java Spring generator:
The @Validated annotation on api class/interface is not rendered when useSpringBuiltInValidation is true.
This removes AOT aspect that is bypassing the built-in handler.

@martin-mfg, @dennisameling this PR targets Kotlin Spring server generator specifically.


Summary by cubic

Implements the useSpringBuiltInValidation option in the Kotlin Spring generator to use Spring 6.1+ built-in validation by skipping class-level @Validated. Aligns Kotlin with the Java Spring generator and keeps default behavior unchanged.

  • Bug Fixes
    • Add useSpringBuiltInValidation switch to KotlinSpringServerCodegen.
    • Update api.mustache and apiInterface.mustache to conditionally omit @Validated and its import when the option is true.
    • Add tests for interface and controller outputs, true/false cases, and default behavior.