...

Text file src/github.com/qri-io/jsonschema/testdata/draft6/allOf.json

Documentation: github.com/qri-io/jsonschema/testdata/draft6

     1[
     2    {
     3        "description": "allOf",
     4        "schema": {
     5            "allOf": [
     6                {
     7                    "properties": {
     8                        "bar": {"type": "integer"}
     9                    },
    10                    "required": ["bar"]
    11                },
    12                {
    13                    "properties": {
    14                        "foo": {"type": "string"}
    15                    },
    16                    "required": ["foo"]
    17                }
    18            ]
    19        },
    20        "tests": [
    21            {
    22                "description": "allOf",
    23                "data": {"foo": "baz", "bar": 2},
    24                "valid": true
    25            },
    26            {
    27                "description": "mismatch second",
    28                "data": {"foo": "baz"},
    29                "valid": false
    30            },
    31            {
    32                "description": "mismatch first",
    33                "data": {"bar": 2},
    34                "valid": false
    35            },
    36            {
    37                "description": "wrong type",
    38                "data": {"foo": "baz", "bar": "quux"},
    39                "valid": false
    40            }
    41        ]
    42    },
    43    {
    44        "description": "allOf with base schema",
    45        "schema": {
    46            "properties": {"bar": {"type": "integer"}},
    47            "required": ["bar"],
    48            "allOf" : [
    49                {
    50                    "properties": {
    51                        "foo": {"type": "string"}
    52                    },
    53                    "required": ["foo"]
    54                },
    55                {
    56                    "properties": {
    57                        "baz": {"type": "null"}
    58                    },
    59                    "required": ["baz"]
    60                }
    61            ]
    62        },
    63        "tests": [
    64            {
    65                "description": "valid",
    66                "data": {"foo": "quux", "bar": 2, "baz": null},
    67                "valid": true
    68            },
    69            {
    70                "description": "mismatch base schema",
    71                "data": {"foo": "quux", "baz": null},
    72                "valid": false
    73            },
    74            {
    75                "description": "mismatch first allOf",
    76                "data": {"bar": 2, "baz": null},
    77                "valid": false
    78            },
    79            {
    80                "description": "mismatch second allOf",
    81                "data": {"foo": "quux", "bar": 2},
    82                "valid": false
    83            },
    84            {
    85                "description": "mismatch both",
    86                "data": {"bar": 2},
    87                "valid": false
    88            }
    89        ]
    90    },
    91    {
    92        "description": "allOf simple types",
    93        "schema": {
    94            "allOf": [
    95                {"maximum": 30},
    96                {"minimum": 20}
    97            ]
    98        },
    99        "tests": [
   100            {
   101                "description": "valid",
   102                "data": 25,
   103                "valid": true
   104            },
   105            {
   106                "description": "mismatch one",
   107                "data": 35,
   108                "valid": false
   109            }
   110        ]
   111    },
   112    {
   113        "description": "allOf with boolean schemas, all true",
   114        "schema": {"allOf": [true, true]},
   115        "tests": [
   116            {
   117                "description": "any value is valid",
   118                "data": "foo",
   119                "valid": true
   120            }
   121        ]
   122    },
   123    {
   124        "description": "allOf with boolean schemas, some false",
   125        "schema": {"allOf": [true, false]},
   126        "tests": [
   127            {
   128                "description": "any value is invalid",
   129                "data": "foo",
   130                "valid": false
   131            }
   132        ]
   133    },
   134    {
   135        "description": "allOf with boolean schemas, all false",
   136        "schema": {"allOf": [false, false]},
   137        "tests": [
   138            {
   139                "description": "any value is invalid",
   140                "data": "foo",
   141                "valid": false
   142            }
   143        ]
   144    },
   145    {
   146        "description": "allOf with one empty schema",
   147        "schema": {
   148            "allOf": [
   149                {}
   150            ]
   151        },
   152        "tests": [
   153            {
   154                "description": "any data is valid",
   155                "data": 1,
   156                "valid": true
   157            }
   158        ]
   159    },
   160    {
   161        "description": "allOf with two empty schemas",
   162        "schema": {
   163            "allOf": [
   164                {},
   165                {}
   166            ]
   167        },
   168        "tests": [
   169            {
   170                "description": "any data is valid",
   171                "data": 1,
   172                "valid": true
   173            }
   174        ]
   175    },
   176    {
   177        "description": "allOf with the first empty schema",
   178        "schema": {
   179            "allOf": [
   180                {},
   181                { "type": "number" }
   182            ]
   183        },
   184        "tests": [
   185            {
   186                "description": "number is valid",
   187                "data": 1,
   188                "valid": true
   189            },
   190            {
   191                "description": "string is invalid",
   192                "data": "foo",
   193                "valid": false
   194            }
   195        ]
   196    },
   197    {
   198        "description": "allOf with the last empty schema",
   199        "schema": {
   200            "allOf": [
   201                { "type": "number" },
   202                {}
   203            ]
   204        },
   205        "tests": [
   206            {
   207                "description": "number is valid",
   208                "data": 1,
   209                "valid": true
   210            },
   211            {
   212                "description": "string is invalid",
   213                "data": "foo",
   214                "valid": false
   215            }
   216        ]
   217    },
   218    {
   219        "description": "nested allOf, to check validation semantics",
   220        "schema": {
   221            "allOf": [
   222                {
   223                    "allOf": [
   224                        {
   225                            "type": "null"
   226                        }
   227                    ]
   228                }
   229            ]
   230        },
   231        "tests": [
   232            {
   233                "description": "null is valid",
   234                "data": null,
   235                "valid": true
   236            },
   237            {
   238                "description": "anything non-null is invalid",
   239                "data": 123,
   240                "valid": false
   241            }
   242        ]
   243    }
   244]

View as plain text