Skip to content

rules for 'deprecation' annotation confusing, inconsistent #948

Closed
@karenetheridge

Description

@karenetheridge

reference: https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.3

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 item according to the subschemas position.

That this rule doesn't really make any sense:

  • what if the 'deprecated' annotation is being applied because of a conditional in the schema? for example:
items:
  if:
    <look for the presence of a particular property/value combination>
  then:
    deprecated: true

And consider an instance where some of the items have the conditional evaluate as true, and some do not. Is it still reasonable to apply the 'deprecated' annotation to all items in the array, when the conditional clearly only applies to some of them?

If, on the other hand, the rule is to be interpreted strictly as "if the schema path ends with "items" and with nothing following, then apply the annotation to the entire array", this rule would not apply, as the schema path for the annotation is ".../items/then/deprecated".

And if that is the case, then this rule should probably also apply to other keywords that apply subschemas to array item instances, namely contains.

(footnote: all of this also needs to be revised to take into account the split of "items" into "items" and prefixItems". But that is an easy search/replace.)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions