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

     1  [
     2      {
     3          "description": "integer type matches integers",
     4          "schema": {
     5              "$schema": "https://json-schema.org/draft/2019-09/schema",
     6              "type": "integer"
     7          },
     8          "tests": [
     9              {
    10                  "description": "an integer is an integer",
    11                  "data": 1,
    12                  "valid": true
    13              },
    14              {
    15                  "description": "a float with zero fractional part is an integer",
    16                  "data": 1.0,
    17                  "valid": true
    18              },
    19              {
    20                  "description": "a float is not an integer",
    21                  "data": 1.1,
    22                  "valid": false
    23              },
    24              {
    25                  "description": "a string is not an integer",
    26                  "data": "foo",
    27                  "valid": false
    28              },
    29              {
    30                  "description": "a string is still not an integer, even if it looks like one",
    31                  "data": "1",
    32                  "valid": false
    33              },
    34              {
    35                  "description": "an object is not an integer",
    36                  "data": {},
    37                  "valid": false
    38              },
    39              {
    40                  "description": "an array is not an integer",
    41                  "data": [],
    42                  "valid": false
    43              },
    44              {
    45                  "description": "a boolean is not an integer",
    46                  "data": true,
    47                  "valid": false
    48              },
    49              {
    50                  "description": "null is not an integer",
    51                  "data": null,
    52                  "valid": false
    53              }
    54          ]
    55      },
    56      {
    57          "description": "number type matches numbers",
    58          "schema": {
    59              "$schema": "https://json-schema.org/draft/2019-09/schema",
    60              "type": "number"
    61          },
    62          "tests": [
    63              {
    64                  "description": "an integer is a number",
    65                  "data": 1,
    66                  "valid": true
    67              },
    68              {
    69                  "description": "a float with zero fractional part is a number (and an integer)",
    70                  "data": 1.0,
    71                  "valid": true
    72              },
    73              {
    74                  "description": "a float is a number",
    75                  "data": 1.1,
    76                  "valid": true
    77              },
    78              {
    79                  "description": "a string is not a number",
    80                  "data": "foo",
    81                  "valid": false
    82              },
    83              {
    84                  "description": "a string is still not a number, even if it looks like one",
    85                  "data": "1",
    86                  "valid": false
    87              },
    88              {
    89                  "description": "an object is not a number",
    90                  "data": {},
    91                  "valid": false
    92              },
    93              {
    94                  "description": "an array is not a number",
    95                  "data": [],
    96                  "valid": false
    97              },
    98              {
    99                  "description": "a boolean is not a number",
   100                  "data": true,
   101                  "valid": false
   102              },
   103              {
   104                  "description": "null is not a number",
   105                  "data": null,
   106                  "valid": false
   107              }
   108          ]
   109      },
   110      {
   111          "description": "string type matches strings",
   112          "schema": {
   113              "$schema": "https://json-schema.org/draft/2019-09/schema",
   114              "type": "string"
   115          },
   116          "tests": [
   117              {
   118                  "description": "1 is not a string",
   119                  "data": 1,
   120                  "valid": false
   121              },
   122              {
   123                  "description": "a float is not a string",
   124                  "data": 1.1,
   125                  "valid": false
   126              },
   127              {
   128                  "description": "a string is a string",
   129                  "data": "foo",
   130                  "valid": true
   131              },
   132              {
   133                  "description": "a string is still a string, even if it looks like a number",
   134                  "data": "1",
   135                  "valid": true
   136              },
   137              {
   138                  "description": "an empty string is still a string",
   139                  "data": "",
   140                  "valid": true
   141              },
   142              {
   143                  "description": "an object is not a string",
   144                  "data": {},
   145                  "valid": false
   146              },
   147              {
   148                  "description": "an array is not a string",
   149                  "data": [],
   150                  "valid": false
   151              },
   152              {
   153                  "description": "a boolean is not a string",
   154                  "data": true,
   155                  "valid": false
   156              },
   157              {
   158                  "description": "null is not a string",
   159                  "data": null,
   160                  "valid": false
   161              }
   162          ]
   163      },
   164      {
   165          "description": "object type matches objects",
   166          "schema": {
   167              "$schema": "https://json-schema.org/draft/2019-09/schema",
   168              "type": "object"
   169          },
   170          "tests": [
   171              {
   172                  "description": "an integer is not an object",
   173                  "data": 1,
   174                  "valid": false
   175              },
   176              {
   177                  "description": "a float is not an object",
   178                  "data": 1.1,
   179                  "valid": false
   180              },
   181              {
   182                  "description": "a string is not an object",
   183                  "data": "foo",
   184                  "valid": false
   185              },
   186              {
   187                  "description": "an object is an object",
   188                  "data": {},
   189                  "valid": true
   190              },
   191              {
   192                  "description": "an array is not an object",
   193                  "data": [],
   194                  "valid": false
   195              },
   196              {
   197                  "description": "a boolean is not an object",
   198                  "data": true,
   199                  "valid": false
   200              },
   201              {
   202                  "description": "null is not an object",
   203                  "data": null,
   204                  "valid": false
   205              }
   206          ]
   207      },
   208      {
   209          "description": "array type matches arrays",
   210          "schema": {
   211              "$schema": "https://json-schema.org/draft/2019-09/schema",
   212              "type": "array"
   213          },
   214          "tests": [
   215              {
   216                  "description": "an integer is not an array",
   217                  "data": 1,
   218                  "valid": false
   219              },
   220              {
   221                  "description": "a float is not an array",
   222                  "data": 1.1,
   223                  "valid": false
   224              },
   225              {
   226                  "description": "a string is not an array",
   227                  "data": "foo",
   228                  "valid": false
   229              },
   230              {
   231                  "description": "an object is not an array",
   232                  "data": {},
   233                  "valid": false
   234              },
   235              {
   236                  "description": "an array is an array",
   237                  "data": [],
   238                  "valid": true
   239              },
   240              {
   241                  "description": "a boolean is not an array",
   242                  "data": true,
   243                  "valid": false
   244              },
   245              {
   246                  "description": "null is not an array",
   247                  "data": null,
   248                  "valid": false
   249              }
   250          ]
   251      },
   252      {
   253          "description": "boolean type matches booleans",
   254          "schema": {
   255              "$schema": "https://json-schema.org/draft/2019-09/schema",
   256              "type": "boolean"
   257          },
   258          "tests": [
   259              {
   260                  "description": "an integer is not a boolean",
   261                  "data": 1,
   262                  "valid": false
   263              },
   264              {
   265                  "description": "zero is not a boolean",
   266                  "data": 0,
   267                  "valid": false
   268              },
   269              {
   270                  "description": "a float is not a boolean",
   271                  "data": 1.1,
   272                  "valid": false
   273              },
   274              {
   275                  "description": "a string is not a boolean",
   276                  "data": "foo",
   277                  "valid": false
   278              },
   279              {
   280                  "description": "an empty string is not a boolean",
   281                  "data": "",
   282                  "valid": false
   283              },
   284              {
   285                  "description": "an object is not a boolean",
   286                  "data": {},
   287                  "valid": false
   288              },
   289              {
   290                  "description": "an array is not a boolean",
   291                  "data": [],
   292                  "valid": false
   293              },
   294              {
   295                  "description": "true is a boolean",
   296                  "data": true,
   297                  "valid": true
   298              },
   299              {
   300                  "description": "false is a boolean",
   301                  "data": false,
   302                  "valid": true
   303              },
   304              {
   305                  "description": "null is not a boolean",
   306                  "data": null,
   307                  "valid": false
   308              }
   309          ]
   310      },
   311      {
   312          "description": "null type matches only the null object",
   313          "schema": {
   314              "$schema": "https://json-schema.org/draft/2019-09/schema",
   315              "type": "null"
   316          },
   317          "tests": [
   318              {
   319                  "description": "an integer is not null",
   320                  "data": 1,
   321                  "valid": false
   322              },
   323              {
   324                  "description": "a float is not null",
   325                  "data": 1.1,
   326                  "valid": false
   327              },
   328              {
   329                  "description": "zero is not null",
   330                  "data": 0,
   331                  "valid": false
   332              },
   333              {
   334                  "description": "a string is not null",
   335                  "data": "foo",
   336                  "valid": false
   337              },
   338              {
   339                  "description": "an empty string is not null",
   340                  "data": "",
   341                  "valid": false
   342              },
   343              {
   344                  "description": "an object is not null",
   345                  "data": {},
   346                  "valid": false
   347              },
   348              {
   349                  "description": "an array is not null",
   350                  "data": [],
   351                  "valid": false
   352              },
   353              {
   354                  "description": "true is not null",
   355                  "data": true,
   356                  "valid": false
   357              },
   358              {
   359                  "description": "false is not null",
   360                  "data": false,
   361                  "valid": false
   362              },
   363              {
   364                  "description": "null is null",
   365                  "data": null,
   366                  "valid": true
   367              }
   368          ]
   369      },
   370      {
   371          "description": "multiple types can be specified in an array",
   372          "schema": {
   373              "$schema": "https://json-schema.org/draft/2019-09/schema",
   374              "type": ["integer", "string"]
   375          },
   376          "tests": [
   377              {
   378                  "description": "an integer is valid",
   379                  "data": 1,
   380                  "valid": true
   381              },
   382              {
   383                  "description": "a string is valid",
   384                  "data": "foo",
   385                  "valid": true
   386              },
   387              {
   388                  "description": "a float is invalid",
   389                  "data": 1.1,
   390                  "valid": false
   391              },
   392              {
   393                  "description": "an object is invalid",
   394                  "data": {},
   395                  "valid": false
   396              },
   397              {
   398                  "description": "an array is invalid",
   399                  "data": [],
   400                  "valid": false
   401              },
   402              {
   403                  "description": "a boolean is invalid",
   404                  "data": true,
   405                  "valid": false
   406              },
   407              {
   408                  "description": "null is invalid",
   409                  "data": null,
   410                  "valid": false
   411              }
   412          ]
   413      },
   414      {
   415          "description": "type as array with one item",
   416          "schema": {
   417              "$schema": "https://json-schema.org/draft/2019-09/schema",
   418              "type": ["string"]
   419          },
   420          "tests": [
   421              {
   422                  "description": "string is valid",
   423                  "data": "foo",
   424                  "valid": true
   425              },
   426              {
   427                  "description": "number is invalid",
   428                  "data": 123,
   429                  "valid": false
   430              }
   431          ]
   432      },
   433      {
   434          "description": "type: array or object",
   435          "schema": {
   436              "$schema": "https://json-schema.org/draft/2019-09/schema",
   437              "type": ["array", "object"]
   438          },
   439          "tests": [
   440              {
   441                  "description": "array is valid",
   442                  "data": [1,2,3],
   443                  "valid": true
   444              },
   445              {
   446                  "description": "object is valid",
   447                  "data": {"foo": 123},
   448                  "valid": true
   449              },
   450              {
   451                  "description": "number is invalid",
   452                  "data": 123,
   453                  "valid": false
   454              },
   455              {
   456                  "description": "string is invalid",
   457                  "data": "foo",
   458                  "valid": false
   459              },
   460              {
   461                  "description": "null is invalid",
   462                  "data": null,
   463                  "valid": false
   464              }
   465          ]
   466      },
   467      {
   468          "description": "type: array, object or null",
   469          "schema": {
   470              "$schema": "https://json-schema.org/draft/2019-09/schema",
   471              "type": ["array", "object", "null"]
   472          },
   473          "tests": [
   474              {
   475                  "description": "array is valid",
   476                  "data": [1,2,3],
   477                  "valid": true
   478              },
   479              {
   480                  "description": "object is valid",
   481                  "data": {"foo": 123},
   482                  "valid": true
   483              },
   484              {
   485                  "description": "null is valid",
   486                  "data": null,
   487                  "valid": true
   488              },
   489              {
   490                  "description": "number is invalid",
   491                  "data": 123,
   492                  "valid": false
   493              },
   494              {
   495                  "description": "string is invalid",
   496                  "data": "foo",
   497                  "valid": false
   498              }
   499          ]
   500      }
   501  ]