[kotlin] Add MicroProfile REST client support

RM
2d ago
+2412-3

Summary

Related to https://github.com/OpenAPITools/openapi-generator/issues/12065: adds Kotlin MicroProfile clients usable with Quarkus, not the server-generation portion of that request.

Adds library=jvm-microprofile to the Kotlin client generator so MicroProfile applications can use Kotlin interfaces and models instead of Java platform types, while retaining their runtime's transport, authentication and header providers.

  • Supports MicroProfile Rest Client 3.0/Jakarta or 2.0/javax, Jackson, optional Mutiny Uni<T>, and explicit or class-derived configuration keys.
  • Preserves nullable parameters/responses and uses Uni<Void?> for bodyless operations. Required nullable fields require JSON presence; required non-null fields reject explicit null, including primitives.
  • Supports discriminator-based allOf and discriminated object oneOf/anyOf interfaces, including alternatives shared between unions.
  • Enables JVM default methods and packages META-INF/beans.xml so separately built client JARs can be discovered by CDI/Quarkus.
  • Rejects incompatible serializers/reactive options, Android Room models, multipart operations and unsupported query serialization instead of silently generating incorrect transport behavior.

The hierarchy repair is related to https://github.com/OpenAPITools/openapi-generator/issues/19928 and https://github.com/OpenAPITools/openapi-generator/issues/22013, but is scoped to this new library; it does not fix those reports' Moshi/Spring configurations. Other Kotlin client libraries retain their existing behavior.

Undiscriminated unions, complete JSON Schema validation and missing-versus-null tracking are outside scope. Jackson's Kotlin module is required; strict collection-element null checking remains a runtime configuration.

Verification

130 targeted generator tests and Checkstyle pass, including a non-MicroProfile Jackson formatting regression. The generated sample has 17 passing real-HTTP Quarkus tests covering polymorphism, nullability, errors, bodyless responses and combined header-factory/header-parameter/filter decorations. Separate-JAR consumption also passes in a Quarkus acceptance harness. Generated sample changes are confined to this library.

PR checklist

  • Read the contribution guidelines.
  • Run the full project build, regenerate all affected samples and export generator documentation. Targeted reactor builds/tests and this library's sample regeneration are complete; the full repository-wide regeneration has not been run.
  • Request review from the Kotlin technical committee.