swagger-api / swagger-codegen-generators

Apache License 2.0
284 stars 424 forks source link

Spring - fix jakarta imports for validation-mode 'strict' #1313

Closed DaScheid closed 3 weeks ago

DaScheid commented 1 month ago

This PR directly addresses commit 2835d9de which was added in https://github.com/swagger-api/swagger-codegen-generators/pull/1308 : When configuring the generator to use imports from the jakarta-namespace, then no javax-imports should be present in the generated files

Current status (before this PR): Generating Spring-sources with the new default validation-mode 'strict' creates java-files 'NotUndefined.java' and 'NotUndefinedValidator.java' with 'javax'-imports independent of the 'jakarta'-flag. This leads to a compile-time error, as these javax-imports cannot be found.

Updated behavior: Dependant on the 'jakarta'-setting on the generator either 'javax'- or 'jakarta'-imports are generated