summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/is-my-json-valid/test/json-schema-draft4/ref.json
blob: d8214bc2b30c1f5226e15a5705084f600524c4cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
[
    {
        "description": "root pointer ref",
        "schema": {
            "properties": {
                "foo": {"$ref": "#"}
            },
            "additionalProperties": false
        },
        "tests": [
            {
                "description": "match",
                "data": {"foo": false},
                "valid": true
            },
            {
                "description": "recursive match",
                "data": {"foo": {"foo": false}},
                "valid": true
            },
            {
                "description": "mismatch",
                "data": {"bar": false},
                "valid": false
            },
            {
                "description": "recursive mismatch",
                "data": {"foo": {"bar": false}},
                "valid": false
            }
        ]
    },
    {
        "description": "relative pointer ref to object",
        "schema": {
            "properties": {
                "foo": {"type": "integer"},
                "bar": {"$ref": "#/properties/foo"}
            }
        },
        "tests": [
            {
                "description": "match",
                "data": {"bar": 3},
                "valid": true
            },
            {
                "description": "mismatch",
                "data": {"bar": true},
                "valid": false
            }
        ]
    },
    {
        "description": "relative pointer ref to array",
        "schema": {
            "items": [
                {"type": "integer"},
                {"$ref": "#/items/0"}
            ]
        },
        "tests": [
            {
                "description": "match array",
                "data": [1, 2],
                "valid": true
            },
            {
                "description": "mismatch array",
                "data": [1, "foo"],
                "valid": false
            }
        ]
    },
    {
        "description": "escaped pointer ref",
        "schema": {
            "tilda~field": {"type": "integer"},
            "slash/field": {"type": "integer"},
            "percent%field": {"type": "integer"},
            "properties": {
                "tilda": {"$ref": "#/tilda~0field"},
                "slash": {"$ref": "#/slash~1field"},
                "percent": {"$ref": "#/percent%25field"}
            }
        },
        "tests": [
            {
                "description": "slash",
                "data": {"slash": "aoeu"},
                "valid": false
            },
            {
                "description": "tilda",
                "data": {"tilda": "aoeu"},
                "valid": false
            },
            {
                "description": "percent",
                "data": {"percent": "aoeu"},
                "valid": false
            }
        ]
    },
    {
        "description": "nested refs",
        "schema": {
            "definitions": {
                "a": {"type": "integer"},
                "b": {"$ref": "#/definitions/a"},
                "c": {"$ref": "#/definitions/b"}
            },
            "$ref": "#/definitions/c"
        },
        "tests": [
            {
                "description": "nested ref valid",
                "data": 5,
                "valid": true
            },
            {
                "description": "nested ref invalid",
                "data": "a",
                "valid": false
            }
        ]
    }
]