title : String
title
StringA preferably short description about the purpose of the instance described by the schema.
Kind | Annotation |
---|---|
Applies To | Any |
Dialect | 2020-12 |
Introduced In | Draft 1 |
Vocabulary | Meta Data |
Specification | https://json-schema.org/draft/2020-12/json-schema-validation.html#section-9.1 |
Metaschema | https://json-schema.org/draft/2020-12/meta/meta-data |
Also see |
Annotations
This keyword produces the title as the annotation value.
Explanation
The title
keyword in JSON Schema is used to provide a human-readable label for a schema or its parts. It does not affect data validation but serves as an informative annotation. The value of this keyword must be a string.
Examples
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Age of a person",
"type": "number"
}
45
{
"valid": true,
"keywordLocation": "/title",
"instanceLocation": "",
"annotation": "Age of a person"
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Personal Info",
"properties": {
"name": { "type": "string" },
"age": { "type": "number" }
},
"if": {
"title": "if block",
"properties": {
"age": { "title": "'if' true", "minimum": 18 }
}
},
"then": {
"title": "then block",
"properties": {
"eligible": { "title": "then applied", "const": true }
}
},
"else": {
"title": "else block",
"properties": {
"eligible": { "title": "else applied", "const": false }
}
}
}
{
"name": "John Doe",
"age": 25,
"eligible": true
}
[
/// ...
{
"valid": true,
"keywordLocation": "/title",
"instanceLocation": "",
"annotation": "Personal Info"
},
{
"valid": true,
"keywordLocation": "/if/title",
"instanceLocation": "",
"annotation": "if block"
},
{
"valid": true,
"keywordLocation": "/if/properties/age/title",
"instanceLocation": "/age",
"annotation": "'if' true"
},
{
"valid": true,
"keywordLocation": "/then/title",
"instanceLocation": "",
"annotation": "then block",
},
{
"valid": true,
"keywordLocation": "/then/properties/eligible/title",
"instanceLocation": "/eligible",
"annotation": "then applied"
},
// ...
]
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Person's name",
"$ref": "#/$defs/name",
"$defs": {
"name": {
"title": "Person's name",
"type": "string"
}
}
}
"John Doe"
[
// ...
{
"valid": true,
"keywordLocation": "/title",
"instanceLocation": "",
"annotation": "Person's name"
},
{
"valid": true,
"keywordLocation": "/$ref/title",
"instanceLocation": "",
"annotation": "Person's name"
},
// ...
]