[kotlin-server] Add configurable inheritance modes
Summary
Addresses https://github.com/OpenAPITools/openapi-generator/issues/11552.
Related to https://github.com/OpenAPITools/openapi-generator/issues/12065; this does not add a dedicated Quarkus generator.
Adds configurable inheritance handling to kotlin-server so discriminator-based models can compile and round-trip through Jackson, including with jaxrs-spec.
inheritanceMode=none|sealed|abstract|composition; defaults toabstractfor JAX-RS andsealedfor Ktor/Javalin. Invalid combinations are rejected.- JAX-RS abstract parents and children preserve inherited optional-property nullability, constructor forwarding and discriminator mappings without duplicating the discriminator in JSON.
- Required nullable properties accept null but require JSON presence; required non-null properties reject explicit null, including primitives. Nullable properties do not receive
@NotNull. - Nullable responses and bodyless Mutiny responses retain nullable Kotlin types.
none is non-polymorphic; composition produces wrappers rather than wire-compatible polymorphism. Discriminated object allOf/oneOf/anyOf hierarchies are covered; arbitrary JSON Schema unions and missing-versus-null tracking are not.
Verification
45 targeted generator tests pass, including nested discriminator inheritance, flat union models, configured visibility, compilation across supported JAX-RS modes with serialization enabled/disabled, discriminator round trips and invalid-input rejection. Checkstyle passes. Regression fixtures are synthetic; no application-specific code or contracts are included.
See the JAX-RS guide for nullability semantics and limitations; the option reference is generated from the code.
PR checklist
- Read the contribution guidelines.
- Run the full project build, regenerate all affected samples and export generator documentation. Targeted reactor builds/tests and generator documentation updates are complete; the full repository-wide regeneration has not been run.
- Request review from the Kotlin technical committee.