Releases: Kotlin/kotlinx-schema
0.4.4
0.4.3
What's Changed
- fix(reflection): Add support for nullable and record properties in reflection JSON schema generation (#263) by @kpavlov in #264
- chore(deps): Bump kotest from 6.1.6 to 6.1.7 by @dependabot[bot] in #254
Full Changelog: v0.4.2...v0.4.3
0.4.2
What's Changed
- fix: propagate node.description for inline PrimitiveNode, ListNode, MapNode (#251) by @kpavlov
- chore(deps): Bump kotest from 6.1.5 to 6.1.6 in /examples/gradle-google-ksp by @dependabot[bot] in #246
Full Changelog: v0.4.1...0.4.2
0.4.1
What's Changed
- fix: missing property descriptions for class types, update tests to check for it by @EugeneTheDev in #238 (#240)
- docs: Improve Module.md annotation descriptions and update Dokka links by @kpavlov in #241
Full Changelog: v0.4.0...v0.4.1
0.4.0
What's Changed
Breaking Changes
-
Polymorphic types support (#212 , #233 by @EugeneTheDev & @kpavlov): Sealed class hierarchies now generate
oneOf/anyOfwith a constant discriminator property per subtype. Breaking changes:JsonSchemaConfig.Strictnow setsrespectDefaultPresence = false— all fields required regardless of Kotlin default valuesincludePolymorphicDiscriminator = trueby default- Sealed subclass names in schemas now use fully qualified names (e.g.
com.example.Animal.Cat) instead of simple names — affects$defskeys,$refpaths, and discriminatorconstvalues
-
$defsreuse andkotlin.Anymapping (#234 by @kpavlov): All named types now register in$defsexactly once and are
referenced via$ref(previously only nullable named types did).kotlin.Any/java.lang.Objectnow emits{}instead of{"type":"object","additionalProperties":false}.
New Features
-
Polymorphic types (#233): Sealed class hierarchies generate
oneOf(JSON Schema) oranyOf(function calling).
ReflectionFunctionIntrospectornow supportssuspend funparameters. Both reflection introspectors support non-recursive polymorphism. -
Class/function filtering with glob patterns (#218 by @kpavlov): New KSP processor options
classesIncludeand
classesExcludeallow filtering which classes are processed for schema generation. -
Constructor parameter annotations (#203 by @@EugeneTheDev): Reflection generator now considers constructor parameter annotations when resolving property descriptions.
Dependency Updates
- Kotest 6.1.3 → 6.1.5
- Gradle wrapper 9.3.1 → 9.4.0
- langchain4j-core 1.11.0 → 1.12.2
- ai.koog:agents-tools 0.6.2 → 0.6.4
- Kotlin mcp sdk 0.8.4 → 0.9.0
- Ktor 3.4.0 → 3.4.1
- ksp-maven-plugin bumped
by @dependabot[bot]
CI / Infra
- Fixed workflow configs and project repo path in Google KSP integration test (#213 by @EugeneTheDev)
- Updated GitHub Actions:
gradle/actions5.0.0 → 5.0.2,actions/upload-artifact6 → 7,actions/download-artifact
7 → 8 by @dependabot[bot]
Full Changelog: v0.3.2...v0.4.0
v0.3.2
What's Changed
Added
- Custom description extraction:
SerializationClassJsonSchemaGeneratornow acceptsSerializationClassSchemaIntrospector.Configwith a pluggableDescriptionExtractor— map any annotation to the schemadescriptionfield without modifying your models (#196) by @EugeneTheDev and @kpavlov
Documentation
- New guide: Serialization-Based Schema Generation covering setup, configuration, and polymorphic types by @kpavlov
- Knit integration: README and guide code examples are now compiled and verified (#187) by @kpavlov
Dependencies
- Bump
kspfrom 2.3.5 to 2.3.6 by @dependabot - Bump
io.github.oshai:kotlin-loggingfrom 7.0.14 to 8.0.01 by @dependabot
New Contributors
- @EugeneTheDev made their first contribution in #196
Full Changelog: v0.3.1...v0.3.2
0.3.1
What's Changed
Added
- Support WasmJS/Browser and watchOS X64 targets by @kpavlov in #182
- MCP server example with auto-generated JSON schema by @kpavlov in #175
Fixed
Multiple dependencies were updated along the way.
Full Changelog: v0.3.0...v0.3.1
0.3.0
What's Changed
Breaking Changes
- Migrate "kotlinx-schema-generator-core" and "kotlinx-schema-generator-json to Kotlin Multiplatform (#147) by @kpavlov in #149
New features
Changed
- refactor(json): Migrate kx.serialization tests to
commonTest(#147) by @kpavlov in #150 - Extract introspector's shared logic by @kpavlov in #145
- docs: Update Module.md files for Dokka by @kpavlov in #146
Fixed
- Package structure: Moved
TypeGraphToJsonObjectSchemaTransformertokotlinx.schema.json
Full Changelog: v0.2.0...v0.3.0
0.2.0
What's Changed
Breaking Changes
- JsonSchema:
additionalPropertiesAPI: ReplacedJsonPrimitivewith type-safeAdditionalPropertiesConstraintsealed interface by @kpavlov- Use
AllowAdditionalProperties,DenyAdditionalProperties, orAdditionalPropertiesSchema(schema)instead of boolean primitives - Enables compile-time type safety and better IDE support
- Use
Added
- kotlinx.serialization support: New
SerializationClassJsonSchemaGeneratorfor runtime introspection (#84) by @kpavlov- 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.serialization model!
- Generate schemas from
- Extended type-safe Schema DSL by @kpavlov
- Internal API markers:
@InternalSchemaGeneratorApiannotation for APIs subject to change by @kpavlov - Documentation: Architecture pipeline overview with + diagrams by @kpavlov
Changed
- Serializers refactoring: Consolidated six enum serializers into a generic
TypedEnumSerializerby @kpavlov- Moved serializers to a dedicated package for better organization
- Simplified
StringOrListSerializerandAdditionalPropertiesSerializer
- Introspection architecture: Extracted shared state management into
BaseIntrospectionContext<TDecl, TType>by @kpavlov- Eliminates code duplication across Reflection, KSP, and Serialization backends
- Unified cycle detection and type caching
Fixed
- Complex object parameters in function calling schemas are now handled correctly by @kpavlov
- Extracted shared type handlers (
handleAnyFallback,handleSealedClass,handleEnum,handleObjectOrClass) - Improved error messages for unhandled KSType cases
- Extracted shared type handlers (
Dependencies
- Bump
kotlinx.koverfrom 0.9.4 to 0.9.5 by @dependabot - Bump
gradlefrom 9.3.0 to 9.3.1
Full Changelog: v0.1.0...v0.2.0
0.1.0
Breaking Changes
- 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)
Added
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
Changed
- 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
Fixed
- Reflection and KSP generators produce different JSON Schema of different formats #45 by @kpavlov
- Enum root schemas now generate correctly (previously generated empty objects)
- Local classes now use
simpleNamefallback instead of failing
Dependencies
- 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) - Bump
ksp-maven-plugin: 0.3.0 (examples)
Full Changelog: 0.0.5...v0.1.0