JsonSchema

data class JsonSchema(val type: @Serializable(with = JsonSchema.SchemaType.Serializer::class) JsonSchema.SchemaType? = null, val title: String? = null, val description: String? = null, val required: List<String>? = null, val allOf: List<ReferenceOr<JsonSchema>>? = null, val oneOf: List<ReferenceOr<JsonSchema>>? = null, val not: ReferenceOr<JsonSchema>? = null, val anyOf: List<ReferenceOr<JsonSchema>>? = null, val properties: Map<String, ReferenceOr<JsonSchema>>? = null, val additionalProperties: AdditionalProperties? = null, val discriminator: JsonSchemaDiscriminator? = null, val readOnly: Boolean? = null, val writeOnly: Boolean? = null, val xml: Xml? = null, val externalDocs: ExternalDocs? = null, val example: GenericElement? = null, val examples: List<GenericElement>? = null, val deprecated: Boolean? = null, val maxProperties: Int? = null, val minProperties: Int? = null, val default: GenericElement? = null, val format: String? = null, val items: ReferenceOr<JsonSchema>? = null, val maximum: Double? = null, val exclusiveMaximum: Double? = null, val minimum: Double? = null, val exclusiveMinimum: Double? = null, val maxLength: Int? = null, val minLength: Int? = null, val pattern: String? = null, val maxItems: Int? = null, val minItems: Int? = null, val uniqueItems: Boolean? = null, val enum: List<GenericElement?>? = null, val multipleOf: Double? = null, val id: String? = null, val anchor: String? = null, val dynamicAnchor: Boolean? = null)(source)

The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.

Report a problem

Constructors

Link copied to clipboard
constructor(type: @Serializable(with = JsonSchema.SchemaType.Serializer::class) JsonSchema.SchemaType? = null, title: String? = null, description: String? = null, required: List<String>? = null, allOf: List<ReferenceOr<JsonSchema>>? = null, oneOf: List<ReferenceOr<JsonSchema>>? = null, not: ReferenceOr<JsonSchema>? = null, anyOf: List<ReferenceOr<JsonSchema>>? = null, properties: Map<String, ReferenceOr<JsonSchema>>? = null, additionalProperties: AdditionalProperties? = null, discriminator: JsonSchemaDiscriminator? = null, readOnly: Boolean? = null, writeOnly: Boolean? = null, xml: Xml? = null, externalDocs: ExternalDocs? = null, example: GenericElement? = null, examples: List<GenericElement>? = null, deprecated: Boolean? = null, maxProperties: Int? = null, minProperties: Int? = null, default: GenericElement? = null, format: String? = null, items: ReferenceOr<JsonSchema>? = null, maximum: Double? = null, exclusiveMaximum: Double? = null, minimum: Double? = null, exclusiveMinimum: Double? = null, maxLength: Int? = null, minLength: Int? = null, pattern: String? = null, maxItems: Int? = null, minItems: Int? = null, uniqueItems: Boolean? = null, enum: List<GenericElement?>? = null, multipleOf: Double? = null, id: String? = null, anchor: String? = null, dynamicAnchor: Boolean? = null)

Types

Link copied to clipboard

Sets additionalProperties to true or false. Use AdditionalPropertiesRef if you need to define a schema for additional properties.

Link copied to clipboard

Defines the schema for any additional properties not explicitly listed in properties.

Link copied to clipboard
annotation class Anchor(val value: String, val dynamic: Boolean = false)

$anchor

Link copied to clipboard
annotation class AnyOfRefs(val value: String)

Validates the data against any of the provided schema references.

Link copied to clipboard
annotation class Default(val value: String)

default (JSON literal as text)

Link copied to clipboard
Link copied to clipboard
annotation class Description(val value: String)

description

Link copied to clipboard

Configures polymorphism using a discriminator property and optional explicit mappings.

Link copied to clipboard
annotation class Enum(val value: String)

enum (each entry is a JSON literal as text)

Link copied to clipboard
annotation class Example(val value: String)

example (JSON literal as text)

Link copied to clipboard
annotation class Format(val value: String)

format (e.g. "date-time", "uuid")

Link copied to clipboard
annotation class Id(val value: String)

$id

Link copied to clipboard
annotation class Ignore

Skips the property from the inferred JSON schema model

Link copied to clipboard
annotation class ItemsRef(val value: KClass<*>)

Defines the schema for items within an array.

Link copied to clipboard
annotation class Maximum(val value: Double, val exclusive: Boolean = false)

maximum (+ optional exclusivity)

Link copied to clipboard
annotation class MaxItems(val value: Int)

maxItems

Link copied to clipboard
annotation class MaxLength(val value: Int)

maxLength

Link copied to clipboard
annotation class MaxProperties(val value: Int)

maxProperties

Link copied to clipboard
annotation class Minimum(val value: Double, val exclusive: Boolean = false)

minimum (+ optional exclusivity)

Link copied to clipboard
annotation class MinItems(val value: Int)

minItems

Link copied to clipboard
annotation class MinLength(val value: Int)

minLength

Link copied to clipboard
annotation class MinProperties(val value: Int)

minProperties

Link copied to clipboard
annotation class MultipleOf(val value: Double)

multipleOf

Link copied to clipboard
annotation class Not(val value: KClass<*>)

Ensures the data does not match the provided schema.

Link copied to clipboard
annotation class OneOf(val value: KClass<*>)

Validates the data against exactly one of the provided schemas.

Link copied to clipboard
annotation class Pattern(val value: String)

pattern

Link copied to clipboard

readOnly

Link copied to clipboard
annotation class Required(val value: String)

required (property names)

Link copied to clipboard

Represents a sealed interface for defining schema types in a JSON structure.

Link copied to clipboard
annotation class Title(val value: String)

title

Link copied to clipboard
annotation class Type(val value: JsonType)

type (e.g. "string", "object", "array")

Link copied to clipboard

uniqueItems

Link copied to clipboard

writeOnly

Properties

Link copied to clipboard
Link copied to clipboard
@SerialName(value = "$anchor")
val anchor: String?
Link copied to clipboard
Link copied to clipboard

Unlike JSON Schema, this value MUST conform to the defined type for this parameter.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@SerialName(value = "$dynamicAnchor")
val dynamicAnchor: Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@SerialName(value = "$id")
val id: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val xml: Xml?

Functions

Link copied to clipboard