Liquid Studio Documentation
JSON Schema Editor / Graphical Notation Overview / Dependency Container
In This Topic
    Dependency Container
    In This Topic
    Draft 04 Draft 06 Draft 07 Draft 2019-09 Draft 2020-12

    Dependences allow relationships between properties to be defined.

    There are 2 types of dependency supported by the Json Schema standard.

    Property Dependencies

    A property dependency has a name and a list of other property names. If the named property exists, then the list of named properties must also exist.

    In this example if the property 'ISBN' is present then the 'Publisher' property must also be present.

    There is no requirement that any of the property names match a property definition (as they could match against Pattern Property or Additional Property nodes.

    Schema Dependencies 

    A schema dependency has a named property and a sub schema. If the named property exists, then the schema is applied to the containing object, and must validate.

    In this way it is possible to create dependencies that provide more details validation or even exclude other properties when the named property is present (see not).

    In this example if the property 'Price' is present then the contained schema must validate, in this case the property 'Currency' must exist and it must be a string.

    As dependencies only apply to properties (which are only used in instance object validation) if the target schema is not allowed to contain an object, then they are not valid for the schema.

    Prior to draft 2019-09 dependencies were defined in the 'dependencies' property, from draft 2019-09 they have been split 'dependentRequired' and 'dependentSchemas'.

    From draft 2019-09, the use of 'dependencies' is allowed but discouraged.