You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the big differences between Draft 6 and Draft 7 is the description of how a Validator should annotate JSON instances in the presence of possibly short-circuiting operations like oneOf, anyOf and if-then-else. Later drafts rely more heavily on this notion of annotating each each node in the JSON instance. For example, the behavior of the unevaluatedItems keyword in Draft 2020-12 is defined in terms of how the prefixItems, items and contains keywords annotated a particular node in the JSON instance.
The main driver for this change is the acknowledgement that the application code may be in a better position to determine how to address non-conforming data than the simple pass-fail results provided by a Validator that only uses assertions (like this library currently provides).
The major benefit we gain from this approach is that reasoning about the validity of a JSON instance becomes simpler. However, this simplicity has a cost in that it requires:
A custom Jackson JsonNodeFactory that produce an annotatable version of each subclass of JsonNode
Subclasses for each JsonNode to accommodate annotations
Excluding annotations from the Jackson serialization mechanism
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
One of the big differences between Draft 6 and Draft 7 is the description of how a Validator should annotate JSON instances in the presence of possibly short-circuiting operations like
oneOf
,anyOf
andif-then-else
. Later drafts rely more heavily on this notion of annotating each each node in the JSON instance. For example, the behavior of theunevaluatedItems
keyword in Draft 2020-12 is defined in terms of how theprefixItems
,items
andcontains
keywords annotated a particular node in the JSON instance.The main driver for this change is the acknowledgement that the application code may be in a better position to determine how to address non-conforming data than the simple pass-fail results provided by a Validator that only uses assertions (like this library currently provides).
The major benefit we gain from this approach is that reasoning about the validity of a JSON instance becomes simpler. However, this simplicity has a cost in that it requires:
JsonNodeFactory
that produce an annotatable version of each subclass ofJsonNode
JsonNode
to accommodate annotationsBeta Was this translation helpful? Give feedback.
All reactions