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

commonMain.com.copperleaf.json.schema.JsonSchema.kt Maven / Gradle / Ivy

There is a newer version: 0.7.0
Show newest version
package com.copperleaf.json.schema

import com.copperleaf.json.pointer.JsonPointer
import kotlinx.serialization.json.JsonElement

public expect class JsonSchema(input: String) {
    public fun validate(element: JsonElement): SchemaValidationResult

    public companion object {
        public fun parse(input: String): JsonSchema
    }
}

public sealed class SchemaValidationResult(public val isValid: Boolean) {
    public abstract fun issues(pointer: JsonPointer): List

    public object Valid : SchemaValidationResult(true) {
        public override fun issues(pointer: JsonPointer): List = emptyList()
    }

    public abstract class Invalid : SchemaValidationResult(false) {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy