SchemaMerger

class SchemaMerger(options: SchemaMergerOptions = SchemaMergerOptions())

Merges composed schemas (allOf/anyOf/oneOf) and produces flat schema combinations for validation and example generation.

This component does not resolve $ref automatically; callers provide a resolve function when needed.

Parameters

options

configuration controlling merge behavior (e.g., max depth)

Constructors

Link copied to clipboard
constructor(options: SchemaMergerOptions = SchemaMergerOptions())

Functions

Link copied to clipboard
fun getOneOfAnyOfCombinations(schema: Schema<*>, visitedRefs: MutableSet<String>): List<List<Schema<*>>>

Returns combinations of oneOf and anyOf subschemas for expansion.

Link copied to clipboard
fun getSchemaFlatCombinations(schema: Schema<*>, depth: Int = 0, visitedRefs: MutableSet<String> = mutableSetOf(), budget: CombinationBudget? = null, resolve: (Schema<*>) -> Schema<*> = { it }): List<Schema<*>>

Expands a schema with oneOf/anyOf into all possible flat combinations.

Link copied to clipboard
fun merge(source: Schema<*>, schemasToMerge: List<Schema<*>>, depth: Int, visitedRefs: MutableSet<String>, resolve: (Schema<*>) -> Schema<*>): Schema<*>

Merges multiple schemas into a single target schema by combining their constraints.

Link copied to clipboard
fun mergeWithSubSchemas(input: Schema<*>, depth: Int, visitedRefs: MutableSet<String>, resolve: (Schema<*>) -> Schema<*> = { it }): Schema<*>

Merges a schema with its allOf/anyOf/oneOf subschemas into a single flat schema.