All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.erosb.jsonsKema.Schema.kt Maven / Gradle / Ivy

The newest version!
package com.github.erosb.jsonsKema

abstract class Schema(open val location: SourceLocation) {
    abstract fun 

accept(visitor: SchemaVisitor

): P? open fun subschemas(): Collection = emptyList() } data class CompositeSchema( val subschemas: Set, override val location: SourceLocation = UnknownSource, val id: IJsonString? = null, val title: IJsonString? = null, val description: IJsonString? = null, val deprecated: IJsonBoolean? = null, val default: IJsonValue? = null, val dynamicRef: DynamicReference? = null, val dynamicAnchor: String? = null, val propertySchemas: Map = emptyMap(), val patternPropertySchemas: Map = emptyMap(), val unevaluatedItemsSchema: Schema? = null, val unevaluatedPropertiesSchema: Schema? = null, val unprocessedProperties: Map = emptyMap(), val vocabulary: List = emptyList(), val definedSubschemas: Map = emptyMap() ) : Schema(location) { override fun

accept(visitor: SchemaVisitor

) = visitor.internallyVisitCompositeSchema(this) override fun subschemas() = subschemas// + definedSubschemas.values } data class ReferenceSchema(var referredSchema: Schema?, val ref: String, override val location: SourceLocation) : Schema(location) { override fun

accept(visitor: SchemaVisitor

) = visitor.visitReferenceSchema(this) override fun subschemas() = referredSchema?.let { listOf(it) } ?: emptyList() override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is ReferenceSchema) return false if (location != other.location) return false return referredSchema === other.referredSchema } override fun hashCode(): Int { return location.hashCode() } override fun toString(): String { return "{\"\$ref\": \"${ref}\", \"resolved\":\"${referredSchema !== null}\"}" } } data class DynamicReference(val ref: String, var fallbackReferredSchema: ReferenceSchema? = null)





© 2015 - 2025 Weber Informatics LLC | Privacy Policy