com.github.erosb.jsonsKema.OneOf.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-sKema Show documentation
Show all versions of json-sKema Show documentation
JSON Schema Parser and Validator
The newest version!
package com.github.erosb.jsonsKema
data class OneOfSchema(
val subschemas: List,
override val location: SourceLocation
) : Schema(location) {
override fun accept(visitor: SchemaVisitor
) = visitor.visitOneOfSchema(this)
override fun subschemas(): Collection = subschemas
}
internal val oneOfLoader: KeywordLoader = { ctx ->
OneOfSchema(arrayToSubschemaList(ctx.keywordValue.requireArray(), ctx.subschemaLoader), ctx.location)
}
data class OneOfValidationFailure(
override val schema: OneOfSchema,
override val instance: IJsonValue,
override val causes: Set,
override val dynamicPath: JsonPointer
) : ValidationFailure(
message = "expected 1 subschema to match out of ${schema.subschemas.size}, ${schema.subschemas.size - causes.size} matched",
schema = schema,
instance = instance,
causes = causes,
keyword = Keyword.ONE_OF
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy