JsonSchema

data class JsonSchema(val type: Set<JsonSchemaType>? = emptySet(), val properties: Map<String, JsonSchema>? = emptyMap(), val patternProperties: Map<String, JsonSchema>? = emptyMap(), val additionalProperties: JsonElement? = null, val items: List<JsonSchema>? = emptyList(), val additionalItems: JsonElement? = null, val required: Boolean? = false, val dependencies: JsonElement? = null, val minimum: Float? = null, val maximum: Float? = null, val exclusiveMinimum: Boolean? = false, val exclusiveMaximum: Boolean? = false, val minItems: Int? = 0, val maxItems: Int? = null, val uniqueItems: Boolean? = false, val pattern: String? = null, val minLength: Int? = 0, val maxLength: Int? = null, val enum: Set<String>? = emptySet(), val default: JsonElement? = null, val title: String? = null, val description: String? = null, val format: JsonSchemaFormat? = null, val divisibleBy: Float? = null, val disallow: Set<JsonSchemaType>? = emptySet(), val extends: List<String>? = emptyList(), val id: String? = null, val metaRef: String? = null, val metaSchema: String? = null)(source)

Data class representing draft 3 of the JSON schema. Note that this data class is not responsible for JSON schema validation.

As per the IETF proposal, all properties are marked as optional.

Constructors

Link copied to clipboard
constructor(type: Set<JsonSchemaType>? = emptySet(), properties: Map<String, JsonSchema>? = emptyMap(), patternProperties: Map<String, JsonSchema>? = emptyMap(), additionalProperties: JsonElement? = null, items: List<JsonSchema>? = emptyList(), additionalItems: JsonElement? = null, required: Boolean? = false, dependencies: JsonElement? = null, minimum: Float? = null, maximum: Float? = null, exclusiveMinimum: Boolean? = false, exclusiveMaximum: Boolean? = false, minItems: Int? = 0, maxItems: Int? = null, uniqueItems: Boolean? = false, pattern: String? = null, minLength: Int? = 0, maxLength: Int? = null, enum: Set<String>? = emptySet(), default: JsonElement? = null, title: String? = null, description: String? = null, format: JsonSchemaFormat? = null, divisibleBy: Float? = null, disallow: Set<JsonSchemaType>? = emptySet(), extends: List<String>? = emptyList(), id: String? = null, metaRef: String? = null, metaSchema: String? = null)

Properties

Link copied to clipboard

This provides a definition for additional items in an array instance when tuple definitions of the items are provided.

Link copied to clipboard

Retrieves the additional items as a boolean.

Link copied to clipboard

This attribute defines a schema for all properties that are not explicitly defined in an object-type definition.

Link copied to clipboard
Link copied to clipboard
val default: JsonElement? = null

This attribute defines the default value of the instance when the instance is undefined.

Link copied to clipboard

This attribute is an object that defines the requirements of a property on an instance object.

Link copied to clipboard

Retrieves the dependencies as a string.

Link copied to clipboard
val description: String? = null

This attribute is a string that provides a full description of the instance property.

Link copied to clipboard

This attribute takes the same values as the type attribute, however if the instance matches the type or if this value is an array and the instance matches any type or schema in the array, then this instance is not valid.

Link copied to clipboard
val divisibleBy: Float? = null

This attribute defines what value the number instance must be divisible by with no remainder (the result of the division must be an integer.)

Link copied to clipboard
val enum: Set<String>?

This provides an enumeration of all possible values that are valid for the instance property.

Link copied to clipboard

This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "maximum" attribute.

Link copied to clipboard

This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "minimum" attribute.

Link copied to clipboard

The value of this property must be another schema which will provide a base schema which the current schema will inherit from.

Link copied to clipboard

This property defines the type of data, content type, or microformat to be expected in the instance property values.

Link copied to clipboard
val id: String? = null

This attribute defines the current URI of this schema (this attribute is effectively a "self" link).

Link copied to clipboard

This attribute defines the allowed items in an instance array, and must be a schema or an array of schemas.

Link copied to clipboard
val maximum: Float? = null

This attribute defines the maximum value of the instance property when the type of the instance value is a number.

Link copied to clipboard
val maxItems: Int? = null

This attribute defines the maximum number of values in an array when the array is the instance value.

Link copied to clipboard
val maxLength: Int? = null

When the instance value is a string, this defines the maximum length of the string.

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

This attribute defines a URI of a schema that contains the full representation of this schema.

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

This attribute defines a URI of a JSON Schema that is the schema of the current schema.

Link copied to clipboard
val minimum: Float? = null

This attribute defines the minimum value of the instance property when the type of the instance value is a number.

Link copied to clipboard
val minItems: Int? = 0

This attribute defines the minimum number of values in an array when the array is the instance value.

Link copied to clipboard
val minLength: Int? = 0

When the instance value is a string, this defines the minimum length of the string.

Link copied to clipboard
val pattern: String? = null

When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid.

Link copied to clipboard

This attribute is an object that defines the schema for a set of property names of an object instance.

Link copied to clipboard

This attribute is an object with property definitions that define the valid values of instance object property values.

Link copied to clipboard
val required: Boolean? = false

This attribute indicates if the instance must have a value, and not be undefined.

Link copied to clipboard
val title: String? = null

This attribute is a string that provides a short description of the instance property.

Link copied to clipboard

This attribute defines what the primitive type or the schema of the instance must be in order to validate. This attribute can take one of two forms:

Link copied to clipboard
val uniqueItems: Boolean? = false

This attribute indicates that all items in an array instance MUST be unique (contains no two identical values).

Functions

Link copied to clipboard

Retrieves the additional items as an object.

Link copied to clipboard
Link copied to clipboard

Retrieves the dependencies as a list of strings. Warning: This function does not check if the value is actually a list.

Link copied to clipboard

Retrieves the dependencies as a JsonSchema. Warning: This function does not check if the value is actually an object.