description : String
description
StringAn explanation about the purpose of the instance described by the schema.
Value | This keyword must be set to a string |
---|---|
Kind | Annotation |
Applies To | Any |
Dialect | 2020-12 |
Changed In | None |
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 |
Official Tests | None |
Default | None |
Annotation | String The description set by this keyword |
Affected By | None |
Affects | None |
Also See |
The description
keyword in JSON Schema is used to provide a human readable description for the schema. It does not affect data validation but serves as an informative annotation.
Examples
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "The age of a person",
"type": "number"
}
45
{ "keyword": "/description", "instance": "", "value": "The age of a person" }
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Personal information of a user",
"properties": {
"name": { "type": "string" },
"age": { "type": "number" }
},
"if": {
"description": "if block",
"properties": {
"age": { "description": "Age", "minimum": 18 }
}
},
"then": {
"description": "then block",
"properties": {
"eligible": { "description": "Eligible", "const": true }
}
},
"else": {
"description": "else block",
"properties": {
"eligible": { "description": "Not eligible", "const": false }
}
}
}
{
"name": "John Doe",
"age": 25,
"eligible": true
}
{ "keyword": "/description", "instance": "", "value": "Personal information of a user" }
{ "keyword": "/if/description", "instance": "", "value": "if block" }
{ "keyword": "/if/properties/age/description", "instance": "/age", "value": "Age" }
{ "keyword": "/then/description", "instance": "", "value": "then block", }
{ "keyword": "/then/properties/eligible/description", "instance": "/eligible", "value": "Eligible" }
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "A person name",
"$ref": "#/$defs/name",
"$defs": {
"name": {
"description": "A person name",
"type": "string"
}
}
}
"John Doe"
{ "keyword": "/description", "instance": "", "value": "A person name" }
{ "keyword": "/$ref/description", "instance": "", "value": "A person name" }