...

Text file src/github.com/go-openapi/validate/fixtures/formats/extended-format.json

Documentation: github.com/go-openapi/validate/fixtures/formats

     1[
     2    {
     3        "description": "Sanity check: validation of date-time strings",
     4        "schema": {"format": "date-time"},
     5        "tests": [
     6            {
     7                "description": "a valid date-time string",
     8                "data": "1963-06-19T08:30:06.283185Z",
     9                "valid": true
    10            },
    11            {
    12                "description": "an invalid date-time string",
    13                "data": "06/19/1963 08:30:06 PST",
    14                "valid": false
    15            },
    16            {
    17                "description": "only RFC3339 not all of ISO 8601 are valid",
    18                "data": "2013-350T01:01:01",
    19                "valid": false
    20            }
    21        ]
    22    },
    23    {
    24        "description": "validation of date strings",
    25        "schema": {"format": "date"},
    26        "tests": [
    27            {
    28                "description": "a valid date string",
    29                "data": "1963-06-19",
    30                "valid": true
    31            },
    32            {
    33                "description": "invalid month in date",
    34                "data": "1963-13-19",
    35                "valid": false
    36            },
    37            {
    38                "description": "invalid day in date",
    39                "data": "1963-12-39",
    40                "valid": false
    41            },
    42            {
    43                "description": "invalid year in date",
    44                "data": "63-12-39",
    45                "valid": false
    46            },
    47            {
    48                "description": "invalid leap year date",
    49                "data": "1999-02-29",
    50                "valid": false
    51            },
    52            {
    53                "description": "date does not validate date-time",
    54                "data": "1963-06-19T08:30:06.283185Z",
    55                "valid": false
    56            },
    57            {
    58                "description": "invalid date",
    59                "data": "2013-350T01:01:01",
    60                "valid": false
    61            },
    62            {
    63                "description": "an invalid date string",
    64                "data": "06/19/1963",
    65                "valid": false
    66            },
    67            {
    68                "description": "only RFC3339 not all of ISO 8601 are valid",
    69                "data": "2013-350T01:01:01",
    70                "valid": false
    71            }
    72        ]
    73    },
    74    {
    75        "description": "sanity check: validation of URIs (literally from json schema test suite)",
    76        "schema": {"format": "uri"},
    77        "tests": [
    78            {
    79                "description": "a valid URI",
    80                "data": "http://foo.bar/?baz=qux#quux",
    81                "valid": true
    82            },
    83            {
    84                "description": "an invalid URI",
    85                "data": "\\\\WINDOWS\\fileshare",
    86                "valid": false
    87            },
    88            {
    89                "description": "an invalid URI though valid URI reference",
    90                "data": "abc",
    91                "valid": false
    92            }
    93        ]
    94    },
    95    {
    96        "description": "sanity check: validation of e-mail addresses (literally from json schema test suite)",
    97        "schema": {"format": "email"},
    98        "tests": [
    99            {
   100                "description": "a valid e-mail address",
   101                "data": "joe.bloggs@example.com",
   102                "valid": true
   103            },
   104            {
   105                "description": "an invalid e-mail address",
   106                "data": "2962",
   107                "valid": false
   108            }
   109        ]
   110    },
   111    {
   112        "description": "sanity check: validation of IP addresses (literally from json schema test suite)",
   113        "schema": {"format": "ipv4"},
   114        "tests": [
   115            {
   116                "description": "a valid IP address",
   117                "data": "192.168.0.1",
   118                "valid": true
   119            },
   120            {
   121                "description": "an IP address with too many components",
   122                "data": "127.0.0.0.1",
   123                "valid": false
   124            },
   125            {
   126                "description": "an IP address with out-of-range values",
   127                "data": "256.256.256.256",
   128                "valid": false
   129            },
   130            {
   131                "description": "an IP address without 4 components",
   132                "data": "127.0",
   133                "valid": false
   134            },
   135            {
   136                "description": "an IP address as an integer",
   137                "data": "0x7f000001",
   138                "valid": false
   139            }
   140        ]
   141    },
   142    {
   143        "description": "sanity check: validation of IPv6 addresses (literally from json schema test suite)",
   144        "schema": {"format": "ipv6"},
   145        "tests": [
   146            {
   147                "description": "a valid IPv6 address",
   148                "data": "::1",
   149                "valid": true
   150            },
   151            {
   152                "description": "an IPv6 address with out-of-range values",
   153                "data": "12345::",
   154                "valid": false
   155            },
   156            {
   157                "description": "an IPv6 address with too many components",
   158                "data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1",
   159                "valid": false
   160            },
   161            {
   162                "description": "an IPv6 address containing illegal characters",
   163                "data": "::laptop",
   164                "valid": false
   165            }
   166        ]
   167    },
   168    {
   169        "description": "sanity check: validation of host names (literally from json schema test suite)",
   170        "schema": {"format": "hostname"},
   171        "tests": [
   172            {
   173                "description": "a valid host name",
   174                "data": "www.example.com",
   175                "valid": true
   176            },
   177            {
   178                "description": "a host name starting with an illegal character",
   179                "data": "-a-host-name-that-starts-with--",
   180                "valid": false
   181            },
   182            {
   183                "description": "a host name containing illegal characters",
   184                "data": "not_a_valid_host_name",
   185                "valid": false
   186            },
   187            {
   188                "description": "a host name with a component too long",
   189                "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
   190                "valid": false
   191            }
   192        ]
   193    },
   194    {
   195        "description": "validation of duration strings",
   196        "schema": {"format": "duration"},
   197        "tests": [
   198            {
   199                "description": "a valid duration string",
   200                "data": "1ns",
   201                "valid": true
   202            },
   203            {
   204                "description": "a valid duration string",
   205                "data": "1min",
   206                "valid": true
   207            },
   208            {
   209                "description": "a valid duration string",
   210                "data": "1wk",
   211                "valid": true
   212            },
   213            {
   214                "description": "a valid duration string",
   215                "data": "3week",
   216                "valid": true
   217            },
   218            {
   219                "description": "a valid duration string",
   220                "data": "3 week",
   221                "valid": true
   222            },
   223            {
   224                "description": "a valid duration string",
   225                "data": "3 weeks",
   226                "valid": true
   227            },
   228            {
   229                "description": "a valid duration string",
   230                "data": "three weeks",
   231                "valid": false
   232            },
   233            {
   234                "description": "an invalid duration string",
   235                "data": "06/19/1963 08:30:06 PST",
   236                "valid": false
   237            },
   238            {
   239                "description": "an invalid duration string",
   240                "data": "06/19/1963 08:30:06 PST",
   241                "valid": false
   242            },
   243            {
   244                "description": "an invalid duration string",
   245                "data": "zorg",
   246                "valid": false
   247            }
   248        ]
   249    },
   250    {
   251        "description": "validation of MAC address strings",
   252        "schema": {"format": "mac"},
   253        "tests": [
   254            {
   255                "description": "a valid MAC address string",
   256                "data": "01:02:03:04:05:06",
   257                "valid": true
   258            },
   259            {
   260                "description": "a valid MAC address string",
   261                "data": "AE:02:03:04:05:06",
   262                "valid": true
   263            },
   264            {
   265                "description": "an invalid MAC address string",
   266                "data": "01:02:03:0G:05:06",
   267                "valid": false
   268            },
   269            {
   270                "description": "an invalid MAC address string",
   271                "data": "01:02:03:04:05:06:07",
   272                "valid": false
   273            }
   274        ]
   275    },
   276    {
   277        "description": "validation of uuid strings",
   278        "schema": {"format": "uuid"},
   279        "tests": [
   280            {
   281                "description": "a valid uuid",
   282                "data": "a8098c1a-f86e-11da-bd1a-00112444be1e",
   283                "valid": true
   284            },
   285            {
   286                "description": "an invalid uuid",
   287                "data": "a8098c1a+f86e+11da+bd1a+00112444be1e",
   288                "valid": false
   289            }
   290        ]
   291    },
   292    {
   293        "description": "validation of uuid3 strings",
   294        "schema": {"format": "uuid3"},
   295        "tests": [
   296            {
   297                "description": "a valid uuid3",
   298                "data": "bcd02e22-68f0-3046-a512-327cca9def8f",
   299                "valid": true
   300            },
   301            {
   302                "description": "an invalid uuid3",
   303                "data": "not-an-uuid3",
   304                "valid": false
   305            },
   306            {
   307                "description": "an invalid uuid3",
   308                "data": "bcg02e22-68f0-3046-a512-327cca9def8f",
   309                "valid": false
   310            }
   311        ]
   312    },
   313    {
   314        "description": "validation of uuid4 strings",
   315        "schema": {"format": "uuid4"},
   316        "tests": [
   317            {
   318                "description": "a valid uuid4",
   319                "data": "025b0d74-00a2-4048-bf57-227c5111bb34",
   320                "valid": true
   321            },
   322            {
   323                "description": "an invalid uuid4",
   324                "data": "not-an-uuid4",
   325                "valid": false
   326            },
   327            {
   328                "description": "an invalid uuid4",
   329                "data": "025b0d74-00a2-4048-bf57-227x5111bb34",
   330                "valid": false
   331            }
   332        ]
   333    },
   334    {
   335        "description": "validation of uuid5 strings",
   336        "schema": {"format": "uuid5"},
   337        "tests": [
   338            {
   339                "description": "a valid uuid5",
   340                "data": "886313e1-3b8a-5372-9b90-0c9aee199e5d",
   341                "valid": true
   342            },
   343            {
   344                "description": "an invalid uuid5",
   345                "data": "886313e1/3b8a-5372/9b90/0c9aee199e5d",
   346                "valid": false
   347            },
   348            {
   349                "description": "an invalid uuid5",
   350                "data": "886313h1-3b8a-5372-9b90-0c9aee199e5d",
   351                "valid": false
   352            }
   353        ]
   354    },
   355    {
   356        "description": "test password format (pass-through)",
   357        "schema": {"format": "password"},
   358        "tests": [
   359            {
   360                "description": "a valid password",
   361                "data": "secret",
   362                "valid": true
   363            }
   364        ]
   365    },
   366    {
   367        "description": "validation of ISBN strings",
   368        "schema": {"format": "isbn"},
   369        "tests": [
   370            {
   371                "description": "a valid ISBN",
   372                "data": "0321751043",
   373                "valid": true
   374            },
   375            {
   376                "description": "an invalid ISBN",
   377                "data": "03217510X3",
   378                "valid": false
   379            }
   380        ]
   381    },
   382    {
   383        "description": "validation of ISBN10 strings",
   384        "schema": {"format": "isbn10"},
   385        "tests": [
   386            {
   387                "description": "a valid ISBN10",
   388                "data": "0321751043",
   389                "valid": true
   390            },
   391            {
   392                "description": "an invalid ISBN10",
   393                "data": "032175104300000500",
   394                "valid": false
   395            }
   396        ]
   397    },
   398    {
   399        "description": "validation of ISBN13 strings",
   400        "schema": {"format": "isbn13"},
   401        "tests": [
   402            {
   403                "description": "a valid ISBN13",
   404                "data": "978 3401013190",
   405                "valid": true
   406            },
   407            {
   408                "description": "an invalid ISBN13",
   409                "data": "032175104300000500",
   410                "valid": false
   411            }
   412        ]
   413    },
   414    {
   415        "description": "validation of creditcard strings",
   416        "schema": {"format": "creditcard"},
   417        "tests": [
   418            {
   419                "description": "a valid creditcard",
   420                "data": "4111-1111-1111-1111",
   421                "valid": true
   422            },
   423            {
   424                "description": "an invalid creditcard",
   425                "data": "4111-1111-1111-11A1",
   426                "valid": false
   427            }
   428        ]
   429    },
   430    {
   431        "description": "validation of SSN strings",
   432        "schema": {"format": "ssn"},
   433        "tests": [
   434            {
   435                "description": "a valid SSN",
   436                "data": "111-11-1111",
   437                "valid": true
   438            },
   439            {
   440                "description": "an invalid SSN",
   441                "data": "111-111111",
   442                "valid": false
   443            }
   444        ]
   445    },
   446    {
   447        "description": "validation of hexcolor string",
   448        "schema": {"format": "hexcolor"},
   449        "tests": [
   450            {
   451                "description": "a valid hexcolor",
   452                "data": "#FFFFFF",
   453                "valid": true
   454            },
   455            {
   456                "description": "an invalid hexcolor",
   457                "data": "xFFFFFF",
   458                "valid": false
   459            }
   460        ]
   461    },
   462    {
   463        "description": "validation of RGB color strings",
   464        "schema": {"format": "rgbcolor"},
   465        "tests": [
   466            {
   467                "description": "a valid rgbcolor",
   468                "data": "rgb(255,255,255)",
   469                "valid": true
   470            },
   471            {
   472                "description": "an invalid rgbcolor",
   473                "data": "rgb(100,100)",
   474                "valid": false
   475            }
   476        ]
   477    },
   478    {
   479        "description": "validation of base64 strings",
   480        "schema": {"format": "byte"},
   481        "tests": [
   482            {
   483                "description": "a valid byte (base64)",
   484                "data": "ZWxpemFiZXRocG9zZXk=",
   485                "valid": true
   486            },
   487            {
   488                "description": "an invalid byte (base64)",
   489                "data": "ZWxpemFiZXRocG9zZXk",
   490                "valid": false
   491            }
   492        ]
   493    },
   494    {
   495        "description": "validation of BSON object ID strings",
   496        "schema": {"format": "bsonobjectid"},
   497        "tests": [
   498            {
   499                "description": "a valid bsonobjectid",
   500                "data": "507f1f77bcf86cd799439011",
   501                "valid": true
   502            },
   503            {
   504                "description": "an invalid bsonobjectid",
   505                "data": "x07f1f77bcf86cd799439011",
   506                "valid": false
   507            }
   508        ]
   509    },
   510    {
   511        "description": "validation of unsupported format (pass-through)",
   512        "schema": {"format": "unsupported"},
   513        "tests": [
   514            {
   515                "description": "an invalid format (no validation)",
   516                "data": "my string",
   517                "valid": true
   518            }
   519        ]
   520    }
   521]

View as plain text