xref: /freebsd/contrib/libucl/tests/schema/required.json (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1[
2    {
3        "description": "required validation",
4        "schema": {
5            "properties": {
6                "foo": {},
7                "bar": {}
8            },
9            "required": ["foo"]
10        },
11        "tests": [
12            {
13                "description": "present required property is valid",
14                "data": {"foo": 1},
15                "valid": true
16            },
17            {
18                "description": "non-present required property is invalid",
19                "data": {"bar": 1},
20                "valid": false
21            }
22        ]
23    },
24    {
25        "description": "required default validation",
26        "schema": {
27            "properties": {
28                "foo": {}
29            }
30        },
31        "tests": [
32            {
33                "description": "not required by default",
34                "data": {},
35                "valid": true
36            }
37        ]
38    }
39]
40