Skip to content

[T] JsonSchema

type JsonSchema<AdditionalVocabularies> = AdditionalVocabularies & object;

Type declaration

NameTypeDescription
additionalProperties?| boolean | Refable<JsonSchema<AdditionalVocabularies>>indicates that additional unlisted properties can exist in this schema See https://json-schema.org/draft/2020-12/json-schema-core#name-additionalproperties
allOf?Refable<JsonSchema<AdditionalVocabularies>>[]A collection of schemas that this schema also must conform to. An instance validates successfully against this keyword if it validates successfully against all schemas defined by this keyword’s value. See https://json-schema.org/draft/2020-12/json-schema-core#name-allof
anyOf?Refable<JsonSchema<AdditionalVocabularies>>[]A collection of schemas that this schema may conform to one or more of. An instance validates successfully against this keyword if it validates successfully against at least one schema defined by this keyword’s value. See https://json-schema.org/draft/2020-12/json-schema-core#name-anyof
const?unknownFunctionally equivalent to “enum” with a single value. An instance validates successfully if its value is equal to the value of this keyword. See https://json-schema.org/draft/2020-12/json-schema-validation#name-const
contains?Refable<JsonSchema<AdditionalVocabularies>>An array instance validates successfully against this keyword if at least one of its elements is valid against the given schema, except when minContains is present and has a value of 0. See https://json-schema.org/draft/2020-12/json-schema-core#name-contains
contentEncoding?stringMust be a string. If the schema instance is a string, this property defines that the string SHOULD be interpreted as encoded binary data and decoded using the encoding named by this property. See https://json-schema.org/draft/2020-12/json-schema-validation#name-contentencoding
contentMediaType?stringMust be a string. If the schema instance is a string, this property indicates the media type of the contents of the string. If “contentEncoding” is present, this property describes the decoded string. See https://json-schema.org/draft/2020-12/json-schema-validation#name-contentmediatype
contentSchema?Refable<JsonSchema<AdditionalVocabularies>>If the schema instance is a string and “contentMediaType” is present, this property contains a schema which describes the structure of the string. This should be ignored if “contentMediaType” is not present. See https://json-schema.org/draft/2020-12/json-schema-validation#name-contentschema
default?string | boolean | number | null | Record<string, any>Declares the value of the property that the server will use if none is provided, for example a “count” to control the number of results per page might default to 100 if not supplied by the client in the request. See https://json-schema.org/draft/2020-12/json-schema-validation#name-default
deprecated?booleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. See https://json-schema.org/draft/2020-12/json-schema-validation#name-deprecated
description?stringThis attribute is a string that provides a full description of the schema See https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description
discriminator?OpenAPI3DiscriminatorAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description
enum?(string | number | boolean | null)[]This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value. If this attribute is defined, the instance value MUST be one of the values in the array in order for the schema to be valid. See https://json-schema.org/draft/2020-12/json-schema-validation#name-enum
examples?any[]An array of free-form properties to include examples of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. See https://json-schema.org/draft/2020-12/json-schema-validation#name-examples
exclusiveMaximum?numberRepresenting an exclusive upper limit for a numeric instance. This keyword validates only if the instance is strictly less than (not equal to) to “exclusiveMaximum”. See https://json-schema.org/draft/2020-12/json-schema-validation#name-exclusivemaximum
exclusiveMinimum?numberRepresenting an exclusive lower limit for a numeric instance. This keyword validates only if the instance is strictly greater than (not equal to) to “exclusiveMinimum”. See https://json-schema.org/draft/2020-12/json-schema-validation#name-exclusiveminimum
externalDocs?OpenAPI3ExternalDocsAdditional external documentation for this schema.
format?stringThe extending format for the previously mentioned type.
items?Refable<JsonSchema<AdditionalVocabularies>>This keyword applies its subschema to all instance elements at indexes greater than the lenfth of the “prefixItems” array. See https://json-schema.org/draft/2020-12/json-schema-core#name-items
maxContains?numberMust be a non-negative integer. If “contains” is not present within the same schema object, then this has no effect. An array instance is valid against “maxContains” if the number of elements that are’ valid against the schema defined by “contains” is less than, or equal to, the value of this keyword. See https://json-schema.org/draft/2020-12/json-schema-validation#name-maxcontains
maximum?numberRepresenting an inclusive upper limit for a numeric instance. This keyword validates only if the instance is less than or exactly equal to “maximum”. See https://json-schema.org/draft/2020-12/json-schema-validation#name-maximum
maxItems?numberMust be a non-negative integer. An array instance is valid against “maxItems” if its size is less than, or equal to, the value of this keyword. See https://json-schema.org/draft/2020-12/json-schema-validation#name-maxitems
maxLength?numberMust be a non-negative integer. A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. See https://json-schema.org/draft/2020-12/json-schema-validation#name-maxlength
maxProperties?numberMust be a non-negative integer. An object instance is valid against “maxProperties” if its number of properties is less than, or equal to, the value of this keyword. See https://json-schema.org/draft/2020-12/json-schema-validation#name-maxproperties
minContains?numberMust be a non-negative integer. If “contains” is not present within the same schema object, then this has no effect. An array instance is valid against “minContains” if the number of elements that are’ valid against the schema defined by “contains” is greater than, or equal to, the value of this keyword. See https://json-schema.org/draft/2020-12/json-schema-validation#name-maxcontains
minimum?numberRepresenting an inclusive lower limit for a numeric instance. This keyword validates only if the instance is greater than or exactly equal to “minimum”. See https://json-schema.org/draft/2020-12/json-schema-validation#name-minimum
minItems?numberMust be a non-negative integer. An array instance is valid against “maxItems” if its size is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0. See https://json-schema.org/draft/2020-12/json-schema-validation#name-minitems
minLength?numberMust be a non-negative integer. A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0. See https://json-schema.org/draft/2020-12/json-schema-validation#name-minlength
minProperties?numberMust be a non-negative integer. An object instance is valid against “maxProperties” if its number of properties is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0. See https://json-schema.org/draft/2020-12/json-schema-validation#name-minproperties
multipleOf?numberMust be strictly greater than 0. A numeric instance is valid only if division by this keyword’s value results in an integer. See https://json-schema.org/draft/2020-12/json-schema-validation#name-multipleof
not?Refable<JsonSchema<AdditionalVocabularies>>An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword. See https://json-schema.org/draft/2020-12/json-schema-core#name-not
oneOf?Refable<JsonSchema<AdditionalVocabularies>>[]A collection of schemas that this schema may conform to only one of. An instance validates successfully against this keyword if it validates successfully against exactly one schema defined by this keyword’s value. See https://json-schema.org/draft/2020-12/json-schema-core#name-oneof
pattern?stringShould be a valid regular expression, according to the ECMA 262 regular expression dialect. See https://json-schema.org/draft/2020-12/json-schema-validation#name-pattern
prefixItems?Refable<JsonSchema<AdditionalVocabularies>>[]Validation succeeds if each element of the instance validates against the schema at the same position, if any. This keyword does not constrain the length of the array. If the array is longer than this keyword’s value, this keyword validates only the prefix of matching length. See https://json-schema.org/draft/2020-12/json-schema-core#name-prefixitems
properties?Record<string, | Refable<JsonSchema<AdditionalVocabularies>> | JsonSchema<AdditionalVocabularies>>This attribute is an object with property definitions that define the valid values of instance object property values. When the instance value is an object, the property values of the instance object MUST conform to the property definitions in this object. In this object, each property definition’s value MUST be a schema, and the property’s name MUST be the name of the instance property that it defines. The instance property value MUST be valid according to the schema from the property definition. Properties are considered unordered, the order of the instance properties MAY be in any order. See https://json-schema.org/draft/2020-12/json-schema-core#name-properties
readOnly?booleanProperty is readonly.
required?string[]Elements of this array must be unique. An object instance is valid against this keyword if every item in the array is the name of a property in the instance. Omitting this keyword has the same behavior as an empty array. See https://json-schema.org/draft/2020-12/json-schema-validation#name-required
title?stringThis attribute is a string that provides a short description of the instance property. See https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description
type?| JsonSchemaType | JsonSchemaType[]The JSON type for the schema. If the value is an array, then an instance validates successfully if its type matches any of the types indicated by the string in the array. See https://json-schema.org/draft/2020-12/json-schema-validation#name-type
unevaluatedProperties?| boolean | Refable<JsonSchema<AdditionalVocabularies>>Indicates that additional unlisted properties can exist in this schema. This differs from additionalProperties in that it is aware of any in-place applicators. This includes being aware of properties defined in sibling allOf sub-schemas. See https://json-schema.org/draft/2020-12/json-schema-core#name-unevaluatedproperties
uniqueItems?booleanIf this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique. Omitting this keyword has the same behavior as a value of false. See https://json-schema.org/draft/2020-12/json-schema-validation#name-uniqueitems

Type Parameters

Type ParameterDefault type
AdditionalVocabularies extends objectobject