Skip to content

kotlin-sdkgen 0.4.0

Latest

Choose a tag to compare

@nabobery nabobery released this 30 Aug 06:45
· 1 commit to main since this release
012461a

Kotlin SDKGen 0.4.0 adds immutable client-scoped configuration, explicit SSE envelope payload projection, correct parameter wire encoding, and configuration-cache-safe generated-source wiring for JVM, Kotlin Multiplatform, and Android consumers.

Breaking

  • Generated streaming API: operations configured with x-sdkgen-streaming.payloadProperty now return Flow of the JSON value carried by each SSE data: field instead of Flow of the declared envelope model. In the OpenRouter conformance SDK, this corrects ChatClient.sendChatCompletionRequestStream, ImagesClient.createImagesStream, AnthropicMessagesClient.createMessagesStream, and BetaResponsesClient.createResponsesStream. Consumers of those generated methods must update their stream element types.

Added

  • SdkClientConfig, an immutable client-scoped runtime configuration value for retry and deadline defaults, request hooks, logical and attempt middleware, lifecycle observers, shared retry budgets, and product identity. Generated root and resource clients share one configuration instance while retaining the 0.3.0 constructor ABI.
  • runtime.defaultServer and runtime.userAgentSuffix configuration now reach generated constructors and request identity, with fail-closed validation for invalid URLs and line breaks.
  • x-sdkgen-streaming.payloadProperty projects an SSE envelope property into the generated stream element type and rejects missing or non-object envelope contracts.
  • SdkGenConfiguration.generatedSources exposes the generation task's output as a Gradle file collection for Android and custom Kotlin Multiplatform source-set wiring.

Changed

  • The OpenRouter conformance overlay now projects the documented data payload for chat, image, Anthropic message, and beta response streams; envelope models remain generated.
  • Generated union predicates and parameter encoding omit redundant casts, statically decided type checks, and unnecessary toString() calls, eliminating the tracked high-volume OpenRouter compiler warnings without changing acceptance semantics.
  • StreamingModel.Sse gains payloadProperty while retaining a three-argument secondary constructor for source compatibility.

Fixed

  • Enum-typed path, query, and header parameters use their documented wire values rather than Kotlin enum case names across scalar, repeated, comma-joined, Stripe-indexed, and deep-object encodings.
  • Nullable union branches accept explicit JSON null for nullable properties instead of incorrectly raising NoMatchException.
  • Gradle generated-source wiring no longer queries mapped task output during configuration, restoring Android compilation and configuration-cache reuse.
  • ktlint integration uses the supported filtering API across plugin application order and class-loader boundaries.

Verification

  • The protected release workflow passed the JVM, JS, Android, Linux, and Apple target lanes, API/ABI checks, live cross-corpus parity, benchmark budgets, isolated publication, signed artifact, SBOM, attestation, and external-consumer gates.
  • The OpenRouter corpus generates all 89 operations with zero blockers. The 0.3.0-to-0.4.0 compatibility packet records four intended breaking stream element-type corrections, 29 additive declarations, two unknown digest-level changes, and explicitly unavailable behavior and generated-SDK ABI layers.

Coordinates

  • Maven Central: io.github.nabobery:kotlin-sdkgen-*:0.4.0
  • Gradle Plugin Portal: io.github.nabobery.kotlin-sdkgen version 0.4.0

See the changelog, ADR 0022, compatibility evidence, and support policy.

Full changelog: v0.3.0...v0.4.0