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

     1  [
     2      {
     3          "description": "remote ref",
     4          "schema": {"$ref": "http://localhost:1234/integer.json"},
     5          "tests": [
     6              {
     7                  "description": "remote ref valid",
     8                  "data": 1,
     9                  "valid": true
    10              },
    11              {
    12                  "description": "remote ref invalid",
    13                  "data": "a",
    14                  "valid": false
    15              }
    16          ]
    17      },
    18      {
    19          "description": "fragment within remote ref",
    20          "schema": {"$ref": "http://localhost:1234/subSchemas.json#/definitions/integer"},
    21          "tests": [
    22              {
    23                  "description": "remote fragment valid",
    24                  "data": 1,
    25                  "valid": true
    26              },
    27              {
    28                  "description": "remote fragment invalid",
    29                  "data": "a",
    30                  "valid": false
    31              }
    32          ]
    33      },
    34      {
    35          "description": "ref within remote ref",
    36          "schema": {
    37              "$ref": "http://localhost:1234/subSchemas.json#/definitions/refToInteger"
    38          },
    39          "tests": [
    40              {
    41                  "description": "ref within ref valid",
    42                  "data": 1,
    43                  "valid": true
    44              },
    45              {
    46                  "description": "ref within ref invalid",
    47                  "data": "a",
    48                  "valid": false
    49              }
    50          ]
    51      },
    52      {
    53          "description": "base URI change",
    54          "schema": {
    55              "$id": "http://localhost:1234/",
    56              "items": {
    57                  "$id": "baseUriChange/",
    58                  "items": {"$ref": "folderInteger.json"}
    59              }
    60          },
    61          "tests": [
    62              {
    63                  "description": "base URI change ref valid",
    64                  "data": [[1]],
    65                  "valid": true
    66              },
    67              {
    68                  "description": "base URI change ref invalid",
    69                  "data": [["a"]],
    70                  "valid": false
    71              }
    72          ]
    73      },
    74      {
    75          "description": "base URI change - change folder",
    76          "schema": {
    77              "$id": "http://localhost:1234/scope_change_defs1.json",
    78              "type" : "object",
    79              "properties": {
    80                  "list": {"$ref": "#/definitions/baz"}
    81              },
    82              "definitions": {
    83                  "baz": {
    84                      "$id": "baseUriChangeFolder/",
    85                      "type": "array",
    86                      "items": {"$ref": "folderInteger.json"}
    87                  }
    88              }
    89          },
    90          "tests": [
    91              {
    92                  "description": "number is valid",
    93                  "data": {"list": [1]},
    94                  "valid": true
    95              },
    96              {
    97                  "description": "string is invalid",
    98                  "data": {"list": ["a"]},
    99                  "valid": false
   100              }
   101          ]
   102      },
   103      {
   104          "description": "base URI change - change folder in subschema",
   105          "schema": {
   106              "$id": "http://localhost:1234/scope_change_defs2.json",
   107              "type" : "object",
   108              "properties": {
   109                  "list": {"$ref": "#/definitions/baz/definitions/bar"}
   110              },
   111              "definitions": {
   112                  "baz": {
   113                      "$id": "baseUriChangeFolderInSubschema/",
   114                      "definitions": {
   115                          "bar": {
   116                              "type": "array",
   117                              "items": {"$ref": "folderInteger.json"}
   118                          }
   119                      }
   120                  }
   121              }
   122          },
   123          "tests": [
   124              {
   125                  "description": "number is valid",
   126                  "data": {"list": [1]},
   127                  "valid": true
   128              },
   129              {
   130                  "description": "string is invalid",
   131                  "data": {"list": ["a"]},
   132                  "valid": false
   133              }
   134          ]
   135      },
   136      {
   137          "description": "root ref in remote ref",
   138          "schema": {
   139              "$id": "http://localhost:1234/object",
   140              "type": "object",
   141              "properties": {
   142                  "name": {"$ref": "name.json#/definitions/orNull"}
   143              }
   144          },
   145          "tests": [
   146              {
   147                  "description": "string is valid",
   148                  "data": {
   149                      "name": "foo"
   150                  },
   151                  "valid": true
   152              },
   153              {
   154                  "description": "null is valid",
   155                  "data": {
   156                      "name": null
   157                  },
   158                  "valid": true
   159              },
   160              {
   161                  "description": "object is invalid",
   162                  "data": {
   163                      "name": {
   164                          "name": null
   165                      }
   166                  },
   167                  "valid": false
   168              }
   169          ]
   170      },
   171      {
   172          "description": "remote ref with ref to definitions",
   173          "schema": {
   174              "$id": "http://localhost:1234/schema-remote-ref-ref-defs1.json",
   175              "allOf": [
   176                  { "$ref": "ref-and-definitions.json" }
   177              ]
   178          },
   179          "tests": [
   180              {
   181                  "description": "invalid",
   182                  "data": {
   183                      "bar": 1
   184                  },
   185                  "valid": false
   186              },
   187              {
   188                  "description": "valid",
   189                  "data": {
   190                      "bar": "a"
   191                  },
   192                  "valid": true
   193              }
   194          ]
   195      },
   196      {
   197          "description": "Location-independent identifier in remote ref",
   198          "schema": {
   199              "$ref": "http://localhost:1234/locationIndependentIdentifierPre2019.json#/definitions/refToInteger"
   200          },
   201          "tests": [
   202              {
   203                  "description": "integer is valid",
   204                  "data": 1,
   205                  "valid": true
   206              },
   207              {
   208                  "description": "string is invalid",
   209                  "data": "foo",
   210                  "valid": false
   211              }
   212          ]
   213      },
   214      {
   215          "description": "retrieved nested refs resolve relative to their URI not $id",
   216          "schema": {
   217              "$id": "http://localhost:1234/some-id",
   218              "properties": {
   219                  "name": {"$ref": "nested/foo-ref-string.json"}
   220              }
   221          },
   222          "tests": [
   223              {
   224                  "description": "number is invalid",
   225                  "data": {
   226                      "name": {"foo":  1}
   227                  },
   228                  "valid": false
   229              },
   230              {
   231                  "description": "string is valid",
   232                  "data": {
   233                      "name": {"foo":  "a"}
   234                  },
   235                  "valid": true
   236              }
   237          ]
   238      },
   239      {
   240          "description": "$ref to $ref finds location-independent $id",
   241          "schema": {
   242              "$ref": "http://localhost:1234/draft7/detached-ref.json#/definitions/foo"
   243          },
   244          "tests": [
   245              {
   246                  "description": "number is valid",
   247                  "data": 1,
   248                  "valid": true
   249              },
   250              {
   251                  "description": "non-number is invalid",
   252                  "data": "a",
   253                  "valid": false
   254              }
   255          ]
   256      }
   257  ]