xref: /freebsd/contrib/libucl/tests/schema/ref.json (revision d9f0ce31900a48d1a2bfc1c8c86f79d1e831451a)
197bd480fSBaptiste Daroussin[
297bd480fSBaptiste Daroussin    {
397bd480fSBaptiste Daroussin        "description": "root pointer ref",
497bd480fSBaptiste Daroussin        "schema": {
597bd480fSBaptiste Daroussin            "properties": {
697bd480fSBaptiste Daroussin                "foo": {"$ref": "#"}
797bd480fSBaptiste Daroussin            },
897bd480fSBaptiste Daroussin            "additionalProperties": false
997bd480fSBaptiste Daroussin        },
1097bd480fSBaptiste Daroussin        "tests": [
1197bd480fSBaptiste Daroussin            {
1297bd480fSBaptiste Daroussin                "description": "match",
1397bd480fSBaptiste Daroussin                "data": {"foo": false},
1497bd480fSBaptiste Daroussin                "valid": true
1597bd480fSBaptiste Daroussin            },
1697bd480fSBaptiste Daroussin            {
1797bd480fSBaptiste Daroussin                "description": "recursive match",
1897bd480fSBaptiste Daroussin                "data": {"foo": {"foo": false}},
1997bd480fSBaptiste Daroussin                "valid": true
2097bd480fSBaptiste Daroussin            },
2197bd480fSBaptiste Daroussin            {
2297bd480fSBaptiste Daroussin                "description": "mismatch",
2397bd480fSBaptiste Daroussin                "data": {"bar": false},
2497bd480fSBaptiste Daroussin                "valid": false
2597bd480fSBaptiste Daroussin            },
2697bd480fSBaptiste Daroussin            {
2797bd480fSBaptiste Daroussin                "description": "recursive mismatch",
2897bd480fSBaptiste Daroussin                "data": {"foo": {"bar": false}},
2997bd480fSBaptiste Daroussin                "valid": false
3097bd480fSBaptiste Daroussin            }
3197bd480fSBaptiste Daroussin        ]
3297bd480fSBaptiste Daroussin    },
3397bd480fSBaptiste Daroussin    {
3497bd480fSBaptiste Daroussin        "description": "relative pointer ref to object",
3597bd480fSBaptiste Daroussin        "schema": {
3697bd480fSBaptiste Daroussin            "properties": {
3797bd480fSBaptiste Daroussin                "foo": {"type": "integer"},
3897bd480fSBaptiste Daroussin                "bar": {"$ref": "#/properties/foo"}
3997bd480fSBaptiste Daroussin            }
4097bd480fSBaptiste Daroussin        },
4197bd480fSBaptiste Daroussin        "tests": [
4297bd480fSBaptiste Daroussin            {
4397bd480fSBaptiste Daroussin                "description": "match",
4497bd480fSBaptiste Daroussin                "data": {"bar": 3},
4597bd480fSBaptiste Daroussin                "valid": true
4697bd480fSBaptiste Daroussin            },
4797bd480fSBaptiste Daroussin            {
4897bd480fSBaptiste Daroussin                "description": "mismatch",
4997bd480fSBaptiste Daroussin                "data": {"bar": true},
5097bd480fSBaptiste Daroussin                "valid": false
5197bd480fSBaptiste Daroussin            }
5297bd480fSBaptiste Daroussin        ]
5397bd480fSBaptiste Daroussin    },
5497bd480fSBaptiste Daroussin    {
5597bd480fSBaptiste Daroussin        "description": "relative pointer ref to array",
5697bd480fSBaptiste Daroussin        "schema": {
5797bd480fSBaptiste Daroussin            "items": [
5897bd480fSBaptiste Daroussin                {"type": "integer"},
5997bd480fSBaptiste Daroussin                {"$ref": "#/items/0"}
6097bd480fSBaptiste Daroussin            ]
6197bd480fSBaptiste Daroussin        },
6297bd480fSBaptiste Daroussin        "tests": [
6397bd480fSBaptiste Daroussin            {
6497bd480fSBaptiste Daroussin                "description": "match array",
6597bd480fSBaptiste Daroussin                "data": [1, 2],
6697bd480fSBaptiste Daroussin                "valid": true
6797bd480fSBaptiste Daroussin            },
6897bd480fSBaptiste Daroussin            {
6997bd480fSBaptiste Daroussin                "description": "mismatch array",
7097bd480fSBaptiste Daroussin                "data": [1, "foo"],
7197bd480fSBaptiste Daroussin                "valid": false
7297bd480fSBaptiste Daroussin            }
7397bd480fSBaptiste Daroussin        ]
7497bd480fSBaptiste Daroussin    },
7597bd480fSBaptiste Daroussin    {
7697bd480fSBaptiste Daroussin        "description": "escaped pointer ref",
7797bd480fSBaptiste Daroussin        "schema": {
7897bd480fSBaptiste Daroussin            "tilda~field": {"type": "integer"},
7997bd480fSBaptiste Daroussin            "slash/field": {"type": "integer"},
8097bd480fSBaptiste Daroussin            "percent%field": {"type": "integer"},
8197bd480fSBaptiste Daroussin            "properties": {
8297bd480fSBaptiste Daroussin                "tilda": {"$ref": "#/tilda~0field"},
8397bd480fSBaptiste Daroussin                "slash": {"$ref": "#/slash~1field"},
8497bd480fSBaptiste Daroussin                "percent": {"$ref": "#/percent%25field"}
8597bd480fSBaptiste Daroussin            }
8697bd480fSBaptiste Daroussin        },
8797bd480fSBaptiste Daroussin        "tests": [
8897bd480fSBaptiste Daroussin            {
8997bd480fSBaptiste Daroussin                "description": "slash",
9097bd480fSBaptiste Daroussin                "data": {"slash": "aoeu"},
9197bd480fSBaptiste Daroussin                "valid": false
9297bd480fSBaptiste Daroussin            },
9397bd480fSBaptiste Daroussin            {
9497bd480fSBaptiste Daroussin                "description": "tilda",
9597bd480fSBaptiste Daroussin                "data": {"tilda": "aoeu"},
9697bd480fSBaptiste Daroussin                "valid": false
9797bd480fSBaptiste Daroussin            },
9897bd480fSBaptiste Daroussin            {
9997bd480fSBaptiste Daroussin                "description": "percent",
10097bd480fSBaptiste Daroussin                "data": {"percent": "aoeu"},
10197bd480fSBaptiste Daroussin                "valid": false
10297bd480fSBaptiste Daroussin            }
10397bd480fSBaptiste Daroussin        ]
10497bd480fSBaptiste Daroussin    },
10597bd480fSBaptiste Daroussin    {
10697bd480fSBaptiste Daroussin        "description": "nested refs",
10797bd480fSBaptiste Daroussin        "schema": {
10897bd480fSBaptiste Daroussin            "definitions": {
10997bd480fSBaptiste Daroussin                "a": {"type": "integer"},
11097bd480fSBaptiste Daroussin                "b": {"$ref": "#/definitions/a"},
11197bd480fSBaptiste Daroussin                "c": {"$ref": "#/definitions/b"}
11297bd480fSBaptiste Daroussin            },
11397bd480fSBaptiste Daroussin            "$ref": "#/definitions/c"
11497bd480fSBaptiste Daroussin        },
11597bd480fSBaptiste Daroussin        "tests": [
11697bd480fSBaptiste Daroussin            {
11797bd480fSBaptiste Daroussin                "description": "nested ref valid",
11897bd480fSBaptiste Daroussin                "data": 5,
11997bd480fSBaptiste Daroussin                "valid": true
12097bd480fSBaptiste Daroussin            },
12197bd480fSBaptiste Daroussin            {
12297bd480fSBaptiste Daroussin                "description": "nested ref invalid",
12397bd480fSBaptiste Daroussin                "data": "a",
12497bd480fSBaptiste Daroussin                "valid": false
12597bd480fSBaptiste Daroussin            }
12697bd480fSBaptiste Daroussin        ]
12797bd480fSBaptiste Daroussin    },
12897bd480fSBaptiste Daroussin    {
12997bd480fSBaptiste Daroussin        "description": "remote ref, containing refs itself",
130*d9f0ce31SBaptiste Daroussin        "schema": {"$ref": "http://highsecure.ru/ucl-schema/schema#"},
13197bd480fSBaptiste Daroussin        "tests": [
13297bd480fSBaptiste Daroussin            {
13397bd480fSBaptiste Daroussin                "description": "remote ref valid",
13497bd480fSBaptiste Daroussin                "data": {"minLength": 1},
13597bd480fSBaptiste Daroussin                "valid": true
13697bd480fSBaptiste Daroussin            },
13797bd480fSBaptiste Daroussin            {
13897bd480fSBaptiste Daroussin                "description": "remote ref invalid",
13997bd480fSBaptiste Daroussin                "data": {"minLength": -1},
14097bd480fSBaptiste Daroussin                "valid": false
14197bd480fSBaptiste Daroussin            }
14297bd480fSBaptiste Daroussin        ]
14397bd480fSBaptiste Daroussin    }
14497bd480fSBaptiste Daroussin]
145