com.github.erosb.jsonsKema.AdditionalProperties.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 additionalPropertiesLoader: KeywordLoader = { ctx ->
val keysInProperties = ctx.containingObject["properties"]?.requireObject()
?.properties?.keys?.map { it.value } ?: listOf()
val patternPropertyKeys = ctx.containingObject["patternProperties"]
?.requireObject()?.properties?.keys
?.map { ctx.regexpFactory.createHandler(it.value) }
?: emptyList()
AdditionalPropertiesSchema(ctx.loadSubschema(), keysInProperties, patternPropertyKeys, ctx.location)
}
data class AdditionalPropertiesSchema(
val subschema: Schema,
val keysInProperties: List,
val patternPropertyKeys: Collection,
override val location: SourceLocation
) : Schema(location) {
override fun accept(visitor: SchemaVisitor
) = visitor.visitAdditionalPropertiesSchema(this)
override fun subschemas() = listOf(subschema)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy