deprecated : Boolean
deprecated
BooleanThis keyword indicates that applications should refrain from using the declared property.
Value | This keyword must be set to a boolean value |
---|---|
Kind | Annotation |
Applies To | Any |
Dialect | 2020-12 |
Changed In | None |
Introduced In | 2019-09 |
Vocabulary | Meta Data |
Specification | https://json-schema.org/draft/2020-12/json-schema-validation.html#section-9.3 |
Metaschema | https://json-schema.org/draft/2020-12/meta/meta-data |
Official Tests | None |
Default |
false
|
Annotation | Boolean The boolean value set by this keyword |
Affected By | None |
Affects | None |
Also See |
The deprecated
keyword is used to indicate that a particular property should not be used and may be removed in the future. It provides a warning to users or applications that certain parts of the schema or are no longer recommended for use.
deprecated
does not affect data validation but serves as an informative annotation.- A true value suggests that applications should avoid using the deprecated property, and the property might be removed in future versions of the schema.
Examples
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"deprecated": true,
"type": "number"
}
45
{ "keyword": "/deprecated", "instance": "", "value": true }
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": { "type": "boolean" },
"bar": { "type": "string" }
},
"if": {
"properties": {
"foo": { "const": true }
}
},
"then": {
"properties": {
"bar": { "deprecated": true }
}
},
"else": {
"properties": {
"bar": { "deprecated": false }
}
}
}
{ "foo": false, "bar": "bar" }
{ "keyword": "/else/properties/bar/deprecated", "instance": "/bar", "value": false }
{ "foo": true, "bar": "bar" }
{ "keyword": "/then/properties/bar/deprecated", "instance": "/bar", "value": true }
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"deprecated": true,
"$ref": "#/$defs/name",
"$defs": {
"name": {
"deprecated": true,
"type": "string"
}
}
}
"John Doe"
{ "keyword": "/deprecated", "instance": "", "value": true }
{ "keyword": "/$ref/deprecated", "instance": "", "value": true }