I have a JSON schema that defines JSON documents. There's an use case where we want to deprecate a particular attribute in favour of a new attribute being introduced and want to mark the old attribute as deprecated. Does JSON schema support that?
A root schema containing "deprecated" with a value of true indicates that the entire resource being described MAY be removed in the future.
Gets or sets a flag indicating whether the value can not equal the number defined by the minimum attribute (Minimum).
JSON Schema validation asserts constraints on the structure of instance data. An instance location that satisfies all asserted constraints is then annotated with any keywords that contain non-assertion information, such as descriptive metadata and usage hints.
Properties. The properties (key-value pairs) on an object are defined using the properties keyword. The value of properties is an object, where each key is the name of a property and each value is a schema used to validate that property.
Draft 2019-09 of the JSON Schema Validation spec, published on 2019-09-16, now defines the deprecated
meta-data annotation:
The value of this keyword MUST be a boolean. When multiple occurrences of this keyword are applicable to a single sub-instance, applications SHOULD consider the instance location to be deprecated if any occurrence specifies a true value.
If "deprecated" has a value of boolean true, it indicates that applications SHOULD refrain from usage of the declared property. It MAY mean the property is going to be removed in the future.
A root schema containing "deprecated" with a value of true indicates that the entire resource being described MAY be removed in the future.
When the "deprecated" keyword is applied to an item in an array by means of "items", if "items" is a single schema, the deprecation relates to the whole array, while if "items" is an array of schemas, the deprecation relates to the corrosponding [sic] item according to the subschemas position.
Omitting this keyword has the same behavior as a value of false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With