Liquid Studio 2020
JSON Schema Editor / Graphical Notation Overview / Array Item Container / Contains
In This Topic
    Contains
    In This Topic
    Draft 04 Draft 06 Draft 07

    The contains property provides additional validation rules for an array of items.

    The contains property holds a schema. In order for the instance JSON document to be valid, at least one item in the array must comply with this schema. 

    Example

    JSON Schema
    Copy Code
    "AnArrayOfStrings": {
        "type": "array",
        "items": {
            "type": "string"
        },
        "contains": {
            "type": "string",
            "const": "My Required Value"
        }
    },
    

     The schema above specifies a property 'AnArrayOfStrings', and at least one item in the array must be a string "My Required Value".

    Valid JSON  instance Document
    Copy Code
    "AnArrayOfStrings" : [ "a", "b", "My Required Value", "x" ]