deprecated : Boolean

deprecated

Boolean

This 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 with 'deprecated' keyword Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "deprecated": true,
  "type": "number"
}
Valid An instance with a numeric value is valid Instance
45
Annotations
{ "keyword": "/deprecated", "instance": "", "value": true }
Schema with logical operators Schema
{
  "$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 }
    }
  }
}
Valid Instance
{ "foo": false, "bar": "bar" }
Annotations
{ "keyword": "/else/properties/bar/deprecated", "instance": "/bar", "value": false }
Valid Instance
{ "foo": true, "bar": "bar" }
Annotations
{ "keyword": "/then/properties/bar/deprecated", "instance": "/bar", "value": true }
Schema with multiple annotations for the same instance Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "deprecated": true,
  "$ref": "#/$defs/name",
  "$defs": {
    "name": {
      "deprecated": true,
      "type": "string"
    }
  }
}
Valid Instance
"John Doe"
Annotations
{ "keyword": "/deprecated", "instance": "", "value": true }
{ "keyword": "/$ref/deprecated", "instance": "", "value": true }