• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[
2    {
3        "description": "$anchor inside an enum is not a real identifier",
4        "comment": "the implementation must not be confused by an $anchor buried in the enum",
5        "schema": {
6            "$schema": "https://json-schema.org/draft/next/schema",
7            "$defs": {
8                "anchor_in_enum": {
9                    "enum": [
10                        {
11                            "$anchor": "my_anchor",
12                            "type": "null"
13                        }
14                    ]
15                },
16                "real_identifier_in_schema": {
17                    "$anchor": "my_anchor",
18                    "type": "string"
19                },
20                "zzz_anchor_in_const": {
21                    "const": {
22                        "$anchor": "my_anchor",
23                        "type": "null"
24                    }
25                }
26            },
27            "anyOf": [
28                { "$ref": "#/$defs/anchor_in_enum" },
29                { "$ref": "#my_anchor" }
30            ]
31        },
32        "tests": [
33            {
34                "description": "exact match to enum, and type matches",
35                "data": {
36                    "$anchor": "my_anchor",
37                    "type": "null"
38                },
39                "valid": true
40            },
41            {
42                "description": "in implementations that strip $anchor, this may match either $def",
43                "data": {
44                    "type": "null"
45                },
46                "valid": false
47            },
48            {
49                "description": "match $ref to $anchor",
50                "data": "a string to match #/$defs/anchor_in_enum",
51                "valid": true
52            },
53            {
54                "description": "no match on enum or $ref to $anchor",
55                "data": 1,
56                "valid": false
57            }
58        ]
59    }
60]
61