- Nullable enum parameters in function-calling schemas accept
null. They were emitted as{"type": ["string", "null"], "enum": ["A", "B"]}, whereenumrejectednull. Theenumnow lists it:{"type": ["string", "null"], "enum": ["A", "B", null]}. TheOpenAPIpreset lists it too, next to"nullable": true. - A
nullin a stringenumsurvives deserialization. It was read as the string"null".
StringPropertyDefinition.enumis nowList<String?>?(wasList<String>?) so a string enum can listnull;StringEnumSerializerchanges accordingly. Code that reads the elements as non-nullStringneeds a null check. Thestring { enum = ... }DSL acceptsnullandJsonNullitems.
Published: 2026-11-06
- Schemas now carry the limits built into standard types
(#86). All front ends (reflection, kotlinx.serialization, KSP,
APT) emit them automatically; no annotations needed.
ByteandShort(and Javabyte/Byte,short/Short) getminimum/maximumUByte,UShortandUIntgetminimum: 0and theirmaximum;ULonggetsminimum: 0. Unsigned types were previously emitted as plainInt/LongChar(Javachar/Character) becomes a string of length 1 (minLength/maxLength)ByteArray,ShortArrayandCharArrayelements get the same bounds (KSP)IntandLongare unchanged: plaininteger
- UUID and date/time types are strings with a
format(#86). Previously reflection and APT expanded them into objects.uuid:java.util.UUID,kotlin.uuid.Uuiddate-time:kotlin.time.Instant,kotlinx.datetime.Instant,java.time.Instant,OffsetDateTime,ZonedDateTime,java.util.Datedate:kotlinx.datetime.LocalDate,java.time.LocalDatetime:kotlinx.datetime.LocalTime,java.time.LocalTime,java.time.OffsetTimeLocalDateTimeis a plainstring(JSON Schema has no format for a zone-less date-time)
- Jakarta Bean Validation annotations become schema constraints
(#86) on class properties in the reflection, KSP and APT front
ends and on function parameters in reflection and KSP:
@Min/@Max,@DecimalMin/@DecimalMax(exclusive withinclusive = false),@Positive/@PositiveOrZero,@Negative/@NegativeOrZero,@Size,@NotEmpty,@NotBlank,@Patternand@Email. Annotations are matched by name injakarta.validation.constraintsorjavax.validation.constraints(configurable viaintrospector.annotations.constraint.names), so the validation API is not a dependency. When an annotation and a built-in type range bound the same member, the tighter bound wins; bounds that exclude every value (@Min(200)on aByte) are emitted as written and logged as a warning naming the member, unless the member is nullable, in which casenullstill satisfies them. A negative@Sizebound is ignored with a warning. An inconsistent annotation never fails generation, since the annotated source may not be the user's to fix. A constraint on a property emitted as a$ref(object or enum) is wrapped asallOf: [{ "$ref": ... }, { ... }]. A@Patternwithflagsis skipped with a warning - Validation constraints in the IR (#181), for anyone building
on
kt-schema-generator-core:TypeRef.constraintsholdsMinimum,Maximum,Size,Pattern,FormatorUniqueItems, and both emitters turn them into the matching JSON Schema keywords. On nullable types the constraints apply to the non-null branch only. Experimental: opt in with@ExperimentalSchemaGeneratorApi
- Whole-number bounds are written as integers:
"minimum": 18instead of18.0 - Function-calling schemas omit
descriptionfor an undocumented function instead of emitting"description": "" - Breaking for direct users of the IR:
Property.annotationswas removed. Nothing read or wrote it (#181) - Breaking: drop support for watchosArm32 and iosX64 multiplatform targets.
- KSP function schemas: a parameter with a Kotlin default value is no longer listed in
requiredunder thesimple,lenientandopenapiconfigs. Thestrictconfig still requires every parameter (#180)
- Documentation site with guides for generated schemas, runtime reflection,
function calling, configuration, validation constraints and the JSON Schema DSL, plus search and
llms.txt. It is deployed together with the Dokka API docs (#191, #193)
- kotlin-logging 8.0.6, Gradle 9.8.2, Dokka 2.3.0, Kotest 6.2.6, Jackson BOM 3.2.4 (test-only), networknt json-schema-validator 3.0.9 (test-only), json-unit-assertj 6.4.0 (test-only), Jakarta Validation API 3.1.1 (test-only), langchain4j 1.23.0 (test-only)
Published: 2026-10-05
-
JsonSchemaConfig.Lenientpreset andallowAdditionalPropertiesflag (also onFunctionCallingSchemaConfig, together withLenientandOpenAPIpresets), and theme.kpavlov.kt.schema.configKSP/APT processor option selectingstrict,lenient,openapior a customJsonSchemaConfigclass. WithuseUnionTypesanduseNullableFieldbothfalse, nullable properties carry no null marker and are never required (nullable collection elements and map values get ananyOfnull branch); the function-calling emitter now honorsuseUnionTypes/useNullableField. TheJsonSchemaConfigandFunctionCallingSchemaConfigconstructors gained a trailing parameter; the six-argument constructors are kept for binary compatibility, but Kotlin callers compiled against them with omitted (default) arguments must recompile (#149) -
Inline value classes (
@JvmInline value class) are flattened to their wrapped type in the reflection and KSP front ends;@Descriptionon the class or property is kept (#117) -
kt-schema-apt:BigInteger(integer) andBigDecimal(number) fields (#114) -
Reflection and KSP front ends: the polymorphic discriminator property name honors
@JsonClassDiscriminator("...")and Jackson@JsonTypeInfo(property = "..."), inherited by nested sealed types, instead of always usingtype; configurable viaintrospector.annotations.discriminator.namesandintrospector.annotations.discriminator.attributes -
Reflection and KSP front ends:
kotlin.time.Instantmaps tostring, matching kotlinx.serialization's defaultInstantserializer; previously it was expanded into anepochSeconds/nanosecondsOfSecondobject -
JsonSchemaConfig.shortDefinitionNames(enabled inLenient):$defskeys,$refs, the root$idand discriminatorconstvalues use the shortest unique dotted suffix of the qualified name; annotation names are kept and kotlinx.serialization schemas are never shortened
FunctionCallingSchemaConfig.Default: identical toStrict; useStrict(IDE quick-fix available). It will be removed in a future minor release.
- Breaking, IR migration (#148):
Propertynow stores facts instead of derived flags, andObjectNodeno longer storesrequired; emitters derive requiredness from these facts and their config. The deprecated shims were dropped, so callers of the IR must migrate:Property.hasDefaultValue→Property.optional(set only by explicit markers: a Kotlin default, an optional type-name convention or an optional annotation; a default literal alone does not set it, but still makes the property non-required at emission)Property.defaultValue/isConstant→Property.value:PropertyValue.None,UnknownDefault,Default(Literal)orConst(Literal).Default(Literal.Null)distinguishes "default isnull" from "no default"ObjectNode.requiredis removed; useProperty.isPresenceRequired()(internal API)Property.copy/componentNandObjectNode.copy/componentNchange signature
val x: T? = nullnow emits"default": nullin reflection-based schemas (not under configs that omit the null marker, such asLenient)- Enum property defaults use the emitted entry name (
@SerialName/@JsonPropertyoverride) instead of the constant name, sodefaultis always one of the schema'senumvalues "nullable": trueis no longer stripped from a required nullable property- Breaking: a sealed subtype that declares a property named like the polymorphic discriminator (default
type, or the name from@JsonClassDiscriminator/@JsonTypeInfo) now fails schema generation with anIllegalStateException, in the JSON Schema and function-calling emitters, instead of silently dropping the discriminatorconst
- Reflection, KSP, APT and kotlinx.serialization front ends: generic classes are resolved against their type arguments.
Box<String>andBox<Int>get separate definitions withvaluetyped accordingly, instead of failing with "Unsupported classifier" (reflection), typingvalueas any value (KSP, APT) or merging the applications into one definition (kotlinx.serialization); star projections and generic roots treat type parameters asAny?. Behavior change: aTypeIdof an applied generic ends with its arguments (pkg.Box<kotlin.String>), and its schema name does too (Box_of_String,Pair_of_String_and_Int,Box_of_nullable_String); applications of one generic class under one@JsonTypeNamenow fail like any duplicate name. Recursive applications of one generic value class no longer share a definition. kotlinx.serialization names a class this way only when it is used with several type arguments, after the properties whose types differ; polymorphically recursive classes are cut off after 8 levels (#146) - Distinct types sharing a name override (
@JsonTypeName,@SerialName) are no longer merged into one node; behavior change:TypeId.valueis now the declaration FQN even with an override, and duplicate explicit type names (including ambiguous discriminator values) now fail fast instead of silently falling back to the FQN. kotlinx.serialization also fails fast when distinct types share a serial name with different property names (#147) - Generic inline value classes (e.g.
Wrapper<Int>) now resolve their type arguments in the reflection and KSP front ends; previously reflection threw and KSP emitted an empty schema - Self-wrapping inline value classes (e.g.
value class Tree(val children: List<Tree>)) get a$defsentry of their wrapped shape ({"type": "array", "items": {"$ref": ...}}) in the reflection, KSP andkotlinx.serializationfront ends; previously reflection emitted a dangling$ref, KSP failed processing andkotlinx.serializationoverflowed the stack. Polymorphically recursive ones are cut off after 8 nested levels as "any value" - KSP: typealiases (e.g.
typealias UserId = String) resolve to the type they stand for instead of an empty schema; thekotlin.collectionsaliasesArrayList,HashMap,LinkedHashMap,HashSetandLinkedHashSetmap toarray/objectschemas, andCharmaps tostringlike in the reflection front end - KSP:
@Schema(withSchemaObject = ...)is now honored; previously the annotation arguments were never read and only theme.kpavlov.kt.schema.withSchemaObjectprocessor option applied, contrary to the documented option priority. An explicit annotation value now takes precedence over the option - KSP: processing errors point at the offending declaration and include the stack trace.
- KSP: inline value classes declared in another module (read from compiled output, where KSP reports
INLINEinstead ofVALUE) are flattened to their wrapped type; previously they were emitted as an object with avalueproperty kt-schema-apt: Kotlin@JvmInlinevalue classes used as types in Java classes (detected by thekotlin.jvm.JvmInlineannotation on the compiled box class) are flattened to their wrapped type, type arguments included; previously they were emitted as an object with avalueproperty- Root polymorphic (
oneOf) schemas no longer emit"additionalProperties": falsebesideoneOf. With no siblingproperties, it rejected every valid subtype payload; subtype definitions in$defsstay closed
- Gradle 9.8.0, kotlinx.serialization 1.9.0, KSP 2.3.12, Kotest 6.2.5, JUnit 6.1.3, Jackson BOM 3.2.3 (test-only), networknt json-schema-validator 3.0.8 (test-only), detekt 2.0.0-alpha.6, Kover 0.9.11, slf4j 2.0.20, langchain4j 1.21.0, Koog 1.3.0 (examples)
Published: 2026-08-03
- Default values via Jackson annotations:
@JsonEnumDefaultValueon an enum constant emitsdefaulton that enum's schema;@JsonProperty(defaultValue = "...")populates the property default. The property default only shows up with a non-strictJsonSchemaConfig, since KSP/APT output marks every property required. Configurable viaintrospector.annotations.enumDefault.names,introspector.annotations.defaultValue.namesandintrospector.annotations.defaultValue.attributes(#99)
- Expanded guides (generation modes, configuration, architecture, type support), updated examples (#98)
Published: 2026-08-03
kt-schema-apt: enum support, both as root types and as fields;@JsonTypeName/@JsonPropertyoverride the enum and constant names (#97)
- An enum shared by several
@Schemaroots no longer crashes the processor on the second root kt-schema-apt: an enum with no constants now fails with a clear error instead of emitting"enum": []- KSP:
@SerialNameon enum entries covered by tests
Published: 2026-08-02
- IR API (breaking for direct users of
kt-schema-generator-core):TypeIdis now a value class,ObjectNode/EnumNode/PolymorphicNodeimplement the newNamedTypeNode, andPolymorphicNode.baseNameis nowname(#92) - Function-calling schemas fail with a clear error beyond 8 levels of type nesting (guards against cycles)
- Custom type names (
@SerialName,@JsonTypeName, ...) are respected in$id,$defs,$refand polymorphic discriminator values; unique graph-wide names fall back to the FQN on collision (#92) kt-schema-apt:@Nullableannotation is respected (#91)
- Pure Java annotation-processing example, release pipeline
Published: 2026-08-02
kt-schema-apt: Java annotation processor generating JSON Schema resources at compile time for Java records, classes and interfaces (#75)- Jackson annotations support in reflection, KSP and APT:
@JsonProperty(names),@JsonTypeName(polymorphic subtype names),@JsonIgnore;@get:use-site targets, inherited and singleton properties are honored (#83, #84) - Nullable/optional conventions shared by all front ends: types matching
introspector.nullable.type.names(default*Opt) and@Nullable-style annotations are nullable; optional markers (introspector.annotations.optional.names,introspector.optional.type.names) exclude a property fromrequiredand are opt-in - Jackson 3
JsonNodehierarchy resolves to{}(opaque), and scalar nodes (StringNode,IntNode, ...) to their primitive types (#74)
- Nullable properties stay
requiredby default NoClassDefFoundError: org/slf4j/LoggerFactoryin KSP and APT processor workers (slf4j-simpleis now bundled)
- APT: type nodes are memoized across roots
- Jackson 3 (test-only), KSP 2.3.10, Kotest 6.2.3, JUnit 6.1.2, detekt 2.0.0-alpha.5, Kover 0.9.9
Published: 2026-07-01
jsonSchemaOf<T>()convenience function for kotlinx-serialization, analogous toserializer<T>()(#60)@JsonClassDiscriminatorsupport: per-class discriminator key now takes precedence over the globalJson.classDiscriminatorsetting in sealed polymorphic schema generation (#53)- Built-in kotlinx-serialization JSON types (
JsonObject,JsonElement,JsonArray,JsonPrimitive,JsonNull) are mapped to open schemas instead of crashing; configurable viaSerializationClassSchemaIntrospector.Config.opaqueSerialNamesandintrospector.opaque.type.names(#54)
- Gradle 9.6.1, KSP 2.3.9, langchain4j 1.17.1, kotlin-logging 8.0.4
Published: 2026-06-29
- Migrate from kotlinx-schema to kt-schema #31. Notable changes
include renaming the Kotlin packages from
kotlinx.schematome.kpavlov.kt.schema, renaming Maven coordinates fromorg.jetbrains.kotlinxtome.kpavlov - Remove deprecated Apple platform targets #43
- Compress AGENTS.md
- Update Dokka config
- Update GitHub workflows
kotlinx-schema changes
Published: 2026-04-07
- Open polymorphism support: abstract classes and interfaces generate JSON Schema when subtypes are registered
via
SerializersModule; deterministiconeOf/anyOfoutput with descriptive errors for missing registrations @SerialDescriptionannotation:@SerialInfo-compatible description annotation read automatically by the serialization-based generator — no customDescriptionExtractorneeded (#303, #304)@SchemaIgnore/@SerialSchemaIgnore: exclude sealed subtypes from schema generation; Jackson@JsonIgnoreType
recognized by default; KSP fails fast on contradictory@Schema+@SchemaIgnore(#277)@SerialNamesupport in reflection and KSP: class names, property names, enum entries, sealed subtypes, and
$id/$defs/$refnow honor@SerialNamevia FQN-aware annotation matching (#204, #308)
- Recursive types: schema generation correctly handles recursive sealed hierarchies and self-referencing types;
subtypes
routed through cycle-safe path with idempotent discriminator injection (#307) - Inline value class schemas: generation now matches kotlinx-serialization format; descriptions propagated to flattened primitive schema with correct property-level override precedence; TypeRef caching added
@JsonClassDiscriminatorsupport: per-class discriminator key from@JsonClassDiscriminatornow takes precedence over the globalJson.classDiscriminatorsetting in sealed polymorphic schema generation (#53)
- Bump
kotestfrom 6.1.7 to 6.1.11 - Bump
dokka-gradle-pluginfrom 2.1.0 to 2.2.0 - Bump
kotlinx.koverfrom 0.9.7 to 0.9.8 - Bump
gradle-wrapperfrom 9.4.0 to 9.4.1 - Bump
mcpfrom 0.9.0 to 0.11.0 (examples) - Bump
ai.koog:agents-toolsfrom 0.6.4 to 0.7.3 (examples)
Published: 2026-03-18
- fix: returning empty description for multi-element annotations (#269)
- fix: description is not extracted from non-public annotation interfaces (#269)
Published: 2026-03-17
- Java record class support: reflection schema generator now correctly introspects Java
recordtypes (#263) - Nullable required constructor parameters: default value extraction no longer silently skips nullable required
parameters when building mock constructor arguments, restoring correct defaults detection for classes with
patterns such as
data class Foo(val tag: String? = "abc", val count: Int? = 5)(#263) - Private constructor filtering: fallback constructor lookup now skips
privateconstructors, preventing accidental invocation of synthetic or internal-only constructors (#263)
- Bump
kotestfrom 6.1.6 to 6.1.7
Published: 2026-03-13
- Missing descriptions for inline primitive, list, and map nodes:
node.descriptionis now correctly propagated for inlinePrimitiveNode,ListNode, andMapNodeschemas (#251)
- Bump
kotestfrom 6.1.5 to 6.1.6
Published: 2026-03-10
- Missing property descriptions for class types: class-level
@Descriptionannotations are now correctly propagated to nested object schemas (#238)
- Improved
Module.mdannotation descriptions and updated Dokka links (#241)
Published: 2026-03-09
$defsfor all named types: all named types now always register in$defsand use$refat every call site; previously only nullable named types were emitted as$ref(#194)kotlin.Anymaps to{}: the previous output{"type":"object","additionalProperties":false}was incorrect; the unconstrained schema{}is now used per JSON Schema Draft 2020-12 (#194)- Polymorphic discriminator on by default:
includePolymorphicDiscriminatordefaults totrue— sealed subtype schemas now include aconstdiscriminator property unless explicitly disabled (#212) - Fully-qualified subclass names: sealed subclass names in
$defs,$ref, and discriminatorconstvalues now use fully-qualified names (e.g.com.example.Animal.Cat) instead of simple names (#212) JsonSchemaConfig.StrictandFunctionCallingSchemaConfig.Strict:respectDefaultPresenceset tofalse— all fields are required regardless of Kotlin default values (#212)
- Polymorphic types: sealed class hierarchies generate
oneOf(JSON Schema) oranyOf(function calling) with aconstdiscriminator per subtype, supported across KSP, reflection, and serialization backends (#212) - KSP class/function filtering:
includeandexcludeprocessor options accept glob patterns to filter which classes and functions receive generated extensions (#181) - Constructor parameter annotations for descriptions: reflection generator now also searches constructor parameter annotations when resolving property descriptions (#203)
suspend funsupport:ReflectionFunctionIntrospectornow correctly introspects suspendable functions (#212)
ReflectionClassIntrospectionContextandReflectionFunctionIntrospectionContextmerged into a singleReflectionIntrospectionContext, eliminating duplication (#212)TDecltype parameter removed fromBaseIntrospectionContext(#212)
- Bump
kotestfrom 6.1.3 to 6.1.5 - Bump
ai.koog:agents-toolsfrom 0.6.2 to 0.6.4 - Bump
dev.langchain4j:langchain4j-corefrom 1.11.0 to 1.12.2 - Bump
gradlewrapper from 9.3.1 to 9.4.0
Published: 2026-02-20
- Custom description extraction:
SerializationClassJsonSchemaGeneratornow acceptsSerializationClassSchemaIntrospector.Configwith a pluggableDescriptionExtractor— map any annotation to the schemadescriptionfield without modifying your models (#196)
- New guide: Serialization-Based Schema Generation covering setup, configuration, and polymorphic types (#197)
- Knit integration: README and guide code examples are now compiled and verified (#187)
- Bump
kspfrom 2.3.5 to 2.3.6 - Bump
io.github.oshai:kotlin-loggingfrom 7.0.14 to 8.0.01
Published: 2026-02-12
- Support WasmJS/Browser and watchOS X64 targets
- Move
slf4j.simpledependency to test scope
Published: 2026-02-03
- Multiplatform migration:
kotlinx-schema-generator-coreandkotlinx-schema-generator-jsonare now Kotlin Multiplatform- Affects internal introspection APIs and test structure
- Reflection-based generators remain JVM-only; serialization-based generators now multiplatform
- KDoc support: Parameter, field, and property descriptions extracted from KDoc comments (#109, #148)
- Works with KSP processor for compile-time generation
- Complements
@Descriptionannotations
- Documentation: Updated documentation and
Module.mdfiles - Test migration: Moved tests to
commonTestfor multiplatform compatibility
- Package structure: Moved
TypeGraphToJsonObjectSchemaTransformertokotlinx.schema.json
Published: 2026-02-02
- JsonSchema:
additionalPropertiesAPI: ReplacedJsonPrimitivewith type-safeAdditionalPropertiesConstraintsealed interface- Use
AllowAdditionalProperties,DenyAdditionalProperties, orAdditionalPropertiesSchema(schema)instead of boolean primitives - Enables compile-time type safety and better IDE support
- Use
- kotlinx.serialization support: New
SerializationClassJsonSchemaGeneratorfor runtime introspection- Generate schemas from
SerialDescriptorwithout KSP or reflection - Support for primitives, enums, objects, lists, maps, and polymorphic types
- NB! Type/field descriptions are not supported due to limitations of
kotlinx.serializationmodel!
- Generate schemas from
- Extended type-safe Schema DSL
- Internal API markers:
@InternalSchemaGeneratorApiannotation for APIs subject to change - Documentation: Architecture pipeline overview with + diagrams
- Serializers refactoring: Consolidated six enum serializers into generic
TypedEnumSerializer- Moved serializers to a dedicated package for better organization
- Simplified
StringOrListSerializerandAdditionalPropertiesSerializer
- Introspection architecture: Extracted shared state management into
BaseIntrospectionContext<TDecl, TType>- Eliminates code duplication across Reflection, KSP, and Serialization backends
- Unified cycle detection and type caching
- Complex object parameters in function calling schemas are now handled correctly
- Extracted shared type handlers (
handleAnyFallback,handleSealedClass,handleEnum,handleObjectOrClass) - Improved error messages for unhandled KSType cases
- Extracted shared type handlers (
- Bump
kotlinx.koverfrom 0.9.4 to 0.9.5 - Bump
gradlefrom 9.3.0 to 9.3.1
Published: 2026-02-02
Note: Duplicate entry - see version below for actual release notes.
Published: 2026-01-30
- Flattened
JsonSchemastructure - removed nestedJsonSchemaDefinitionwrapper - Changed nullable representation from
"nullable": trueto["type", "null"](JSON Schema 2020-12) - Removed
strictSchemaFlagconfiguration option - Changed discriminator fields from
defaulttoconstin sealed classes - Reordered
JsonSchemaconstructor parameters (schemabeforeid)
useUnionTypes,useNullableField,includeDiscriminatorconfiguration flagsJsonSchemaConfig.Default,JsonSchemaConfig.Strict,JsonSchemaConfig.OpenAPIpresets- Support for enum and primitive root schemas
- Centralized
formatSchemaId()method for ID generation JsonSchemaConstantsfor reduced object allocation
- Schemas now generate as flat JSON Schema Draft 2020-12 compliant output
- Updated to
ksp-maven-pluginv0.3.0 - Enhanced KSP documentation with Gradle and Maven examples
- Enum root schemas now generate correctly (previously generated empty objects)
- Local classes now use
simpleNamefallback instead of failing
- Bump
ai.koog:agents-toolsfrom 0.6.0 to 0.6.1 - Bump
com.google.devtools.kspfrom 2.3.4 to 2.3.5 (examples)