com.github.erosb.jsonsKema.If.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
package com.github.erosb.jsonsKema
internal val ifThenElseLoader: KeywordLoader = {ctx ->
val ifSchema = ctx.subschemaLoader(ctx.keywordValue)
val thenSchema = ctx.containingObject[Keyword.THEN.value]?.let { ctx.subschemaLoader(it) }
val elseSchema = ctx.containingObject[Keyword.ELSE.value]?.let { ctx.subschemaLoader(it) }
IfThenElseSchema(ifSchema, thenSchema, elseSchema, ctx.location)
}
data class IfThenElseSchema(
val ifSchema: Schema,
val thenSchema: Schema?,
val elseSchema: Schema?,
override val location: SourceLocation
) : Schema(location) {
override fun accept(visitor: SchemaVisitor
): P? = visitor.visitIfThenElseSchema(this)
override fun subschemas() = listOfNotNull(ifSchema, thenSchema, elseSchema)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy