description : String
description
StringAn explanation about the purpose of the instance described by the schema.
Value |
This keyword must be set to a string
Hint: Use the jsonschema metaschema and jsonschema lint commands to catch keywords set to invalid values
|
---|---|
Kind | Annotation |
Applies To | Any |
Base Dialect | Draft 4 |
Changed In | None |
Introduced In | Draft 1 |
Vocabulary | Validation |
Specification | https://json-schema.org/draft-04/draft-fge-json-schema-validation-00#rfc.section.6.1 |
Metaschema | http://json-schema.org/draft-04/schema# |
Official Tests | None |
Default | None |
Annotation | None |
Affected By | None |
Affects | None |
Also See |
|
The description
keyword is a
placeholder for a longer human-readable string summary of what a schema or any
of its subschemas are about. This keyword is merely descriptive and does not
affect validation.
Best Practice
We heavily recommend to declare this keyword at the top level of every schema,
as a human-readable longer description of what the schema is about.
Note that this keyword is meant to be to be used in conjunction with the
title
keyword. The idea is to
augment the short summary with a longer description, and not to avoid the
concise summary altogether.
Common Pitfall
Tooling makers must be careful when statically traversing schemas in search of occurrences of this keyword. It is possible for schemas to make use of this keyword behind conditional operators, references, or any other type of keyword that makes it hard or even impossible to correctly locate these values in all cases.
Examples
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Even Number",
"description": "This schema describes an even number",
"type": "number",
"multipleOf": 2
}
10
7
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Number",
"type": "number",
"anyOf": [
{
"description": "This is an even number",
"multipleOf": 2
},
{
"description": "This is an odd number",
"not": {
"multipleOf": 2
}
}
]
}
10
7
"Hello World"