SchemaGenerator
Generates OpenAPI 3.1 (JSON Schema) schemas from Kotlin IR types, mirroring how the ktkit runtime serializes values with kotlinx.serialization:
@Serializableclasses become named component schemas referenced with$ref.Property names respect
@SerialName,@Transientproperties are omitted.Properties inherited from
@Serializablesuperclasses are included (base-class first).Generic classes get one component per instantiation (e.g.
PageOfTestDto), with type parameters substituted by the concrete type arguments.Sealed hierarchies become
oneOfover the concrete leaves with an@typediscriminator (ktkit'sclassDiscriminator).Nullable types allow
null; properties with default values are notrequired.
All named schemas end up in components; one generator instance is used per handler class so the collected components land in that handler's fragment.
Properties
Functions
Registers ktkit's standard ApiError schema as a component and returns a $ref to it. The descriptions follow RFC 9457 (Problem Details for HTTP APIs) — keep them in sync with the @OpenApiInfo annotations on io.github.smyrgeorge.ktkit.api.rest.ApiError.
An enum schema listing the Kotlin entry names — what Var.asEnum() (enumValueOf) accepts.