description : String

description

String

An 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 with 'description' keyword Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "The age of a person",
  "type": "number"
}
Valid An instance with a numeric value is valid Instance
45
Annotations
{ "keyword": "/description", "instance": "", "value": "The age of a person" }
Schema with logical operators Schema
{
  "$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 }
    }
  }
}
Valid Instance
{
  "name": "John Doe",
  "age": 25,
  "eligible": true
}
Annotations
{ "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 with multiple annotations for the same instance Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "A person name",
  "$ref": "#/$defs/name",
  "$defs": {
    "name": {
      "description": "A person name",
      "type": "string"
    }
  }
}
Valid Instance
"John Doe"
Annotations
{ "keyword": "/description", "instance": "", "value": "A person name" }
{ "keyword": "/$ref/description", "instance": "", "value": "A person name" }