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