TypeGraphToJsonSchemaTransformer
class TypeGraphToJsonSchemaTransformer @JvmOverloads constructor(val config: JsonSchemaConfig, val json: Json = Json { encodeDefaults = false }) : AbstractTypeGraphTransformer<JsonSchema, JsonSchemaConfig> (source)
Transforms TypeGraph IR into JSON Schema Draft 2020-12 format.
Converts type graphs from introspectors (reflection, KSP) into JSON Schema definitions. Supports primitives, collections, objects, enums, and sealed hierarchies with discriminators. All named types (objects, enums, sealed hierarchies) are emitted as $ref with definitions registered in $defs exactly once, regardless of nullability. Nullable named types use oneOf: [{type: null}, {$ref}].
Parameters
json
JSON encoder for schema elements