github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft-next/anchor.json (about)

     1  [
     2      {
     3          "description": "Location-independent identifier",
     4          "schema": {
     5              "$schema": "https://json-schema.org/draft/next/schema",
     6              "$ref": "#foo",
     7              "$defs": {
     8                  "A": {
     9                      "$anchor": "foo",
    10                      "type": "integer"
    11                  }
    12              }
    13          },
    14          "tests": [
    15              {
    16                  "data": 1,
    17                  "description": "match",
    18                  "valid": true
    19              },
    20              {
    21                  "data": "a",
    22                  "description": "mismatch",
    23                  "valid": false
    24              }
    25          ]
    26      },
    27      {
    28          "description": "Location-independent identifier with absolute URI",
    29          "schema": {
    30              "$schema": "https://json-schema.org/draft/next/schema",
    31              "$ref": "http://localhost:1234/draft-next/bar#foo",
    32              "$defs": {
    33                  "A": {
    34                      "$id": "http://localhost:1234/draft-next/bar",
    35                      "$anchor": "foo",
    36                      "type": "integer"
    37                  }
    38              }
    39          },
    40          "tests": [
    41              {
    42                  "data": 1,
    43                  "description": "match",
    44                  "valid": true
    45              },
    46              {
    47                  "data": "a",
    48                  "description": "mismatch",
    49                  "valid": false
    50              }
    51          ]
    52      },
    53      {
    54          "description": "Location-independent identifier with base URI change in subschema",
    55          "schema": {
    56              "$schema": "https://json-schema.org/draft/next/schema",
    57              "$id": "http://localhost:1234/draft-next/root",
    58              "$ref": "http://localhost:1234/draft-next/nested.json#foo",
    59              "$defs": {
    60                  "A": {
    61                      "$id": "nested.json",
    62                      "$defs": {
    63                          "B": {
    64                              "$anchor": "foo",
    65                              "type": "integer"
    66                          }
    67                      }
    68                  }
    69              }
    70          },
    71          "tests": [
    72              {
    73                  "data": 1,
    74                  "description": "match",
    75                  "valid": true
    76              },
    77              {
    78                  "data": "a",
    79                  "description": "mismatch",
    80                  "valid": false
    81              }
    82          ]
    83      },
    84      {
    85          "description": "same $anchor with different base uri",
    86          "schema": {
    87              "$schema": "https://json-schema.org/draft/next/schema",
    88              "$id": "http://localhost:1234/draft-next/foobar",
    89              "$defs": {
    90                  "A": {
    91                      "$id": "child1",
    92                      "allOf": [
    93                          {
    94                              "$id": "child2",
    95                              "$anchor": "my_anchor",
    96                              "type": "number"
    97                          },
    98                          {
    99                              "$anchor": "my_anchor",
   100                              "type": "string"
   101                          }
   102                      ]
   103                  }
   104              },
   105              "$ref": "child1#my_anchor"
   106          },
   107          "tests": [
   108              {
   109                  "description": "$ref resolves to /$defs/A/allOf/1",
   110                  "data": "a",
   111                  "valid": true
   112              },
   113              {
   114                  "description": "$ref does not resolve to /$defs/A/allOf/0",
   115                  "data": 1,
   116                  "valid": false
   117              }
   118          ]
   119      }
   120  ]