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

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