[kotlin-spring] Tests only - Add regression tests and samples for generic interfaces in implements
Description
x-kotlin-implements and schemaImplements in kotlin-spring already work with generic interfaces, because the interface string is emitted verbatim. Nothing guarded that behavior, so this PR adds regression coverage. There are no generator changes.
Unit test: generateModelsImplementingGenericInterfaces uses a new spec, generic-interfaces-implements.yaml. It asserts the full supertype line for these cases:
- one type argument
- several type arguments (commas are not split)
- nested generics
- nullable arguments
- a plain interface alongside generic ones
- both
x-kotlin-implementsandschemaImplements(single-string and list values)
Compile-checked samples:
Taginpetstore-with-x-kotlin-implements.yamlusesx-kotlin-implementswithGenericRepo<Category>andGenericPair<kotlin.String, org.openapitools.model.Category>.Orderin thekotlin-springboot-x-kotlin-implementssample usesschemaImplementswithBoundedRepo<kotlin.Long>,VariantSource<kotlin.collections.List<Tag>>andTwoBounds<kotlin.Int>.- The hand-written interfaces cover declaration forms with bounds,
outvariance andwhereclauses. - Samples
kotlin-springboot-x-kotlin-implementsandkotlin-springboot-include-http-request-context-delegatewere regenerated (the latter shares the spec). Both compile withmvnw compile.
Known limitation (not changed here): no imports are generated for implemented interfaces or their type arguments. Types outside the model package must be fully qualified.
Testing
./mvnw test -pl modules/openapi-generator -Dtest='KotlinSpringServerCodegenTest#generateModelsImplementingGenericInterfaces+generateSerializableModelWithSchemaImplements': passed (2 tests)../mvnw -f samples/server/petstore/kotlin-springboot-x-kotlin-implements/pom.xml compile: success../mvnw -f samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/pom.xml compile: success.- I regenerated the two affected samples with the CLI
batchcommand. I did not run the fullgenerate-samples.shorexport_docs_generators.sh; no option descriptions changed.
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
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. Tagging @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) @AndreyVMarkelov (2026/11)
Summary by cubic
Adds regression coverage proving x-kotlin-implements and schemaImplements in kotlin-spring emit generic interface strings verbatim. No generator changes; the behavior already worked but was unguarded.
- New unit test asserts the full supertype line for one and several type arguments, nested and nullable generics, plain interfaces alongside generic ones, and both single-string and list values for
x-kotlin-implementsandschemaImplements. - Compile-checked samples exercise generic interfaces via
x-kotlin-implements(Tag) andschemaImplements(Order), with hand-written interfaces covering bounds,outvariance, andwhereclauses. - Imports are still not generated for implemented interfaces or their type arguments; types outside the model package must be fully qualified.