github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft2020-12/optional/format/duration.json (about)

     1  [
     2      {
     3          "description": "validation of duration strings",
     4          "schema": {
     5              "$schema": "https://json-schema.org/draft/2020-12/schema",
     6              "format": "duration"
     7          },
     8          "tests": [
     9              {
    10                  "description": "all string formats ignore integers",
    11                  "data": 12,
    12                  "valid": true
    13              },
    14              {
    15                  "description": "all string formats ignore floats",
    16                  "data": 13.7,
    17                  "valid": true
    18              },
    19              {
    20                  "description": "all string formats ignore objects",
    21                  "data": {},
    22                  "valid": true
    23              },
    24              {
    25                  "description": "all string formats ignore arrays",
    26                  "data": [],
    27                  "valid": true
    28              },
    29              {
    30                  "description": "all string formats ignore booleans",
    31                  "data": false,
    32                  "valid": true
    33              },
    34              {
    35                  "description": "all string formats ignore nulls",
    36                  "data": null,
    37                  "valid": true
    38              },
    39              {
    40                  "description": "a valid duration string",
    41                  "data": "P4DT12H30M5S",
    42                  "valid": true
    43              },
    44              {
    45                  "description": "an invalid duration string",
    46                  "data": "PT1D",
    47                  "valid": false
    48              },
    49              {
    50                  "description": "no elements present",
    51                  "data": "P",
    52                  "valid": false
    53              },
    54              {
    55                  "description": "no time elements present",
    56                  "data": "P1YT",
    57                  "valid": false
    58              },
    59              {
    60                  "description": "no date or time elements present",
    61                  "data": "PT",
    62                  "valid": false
    63              },
    64              {
    65                  "description": "elements out of order",
    66                  "data": "P2D1Y",
    67                  "valid": false
    68              },
    69              {
    70                  "description": "missing time separator",
    71                  "data": "P1D2H",
    72                  "valid": false
    73              },
    74              {
    75                  "description": "time element in the date position",
    76                  "data": "P2S",
    77                  "valid": false
    78              },
    79              {
    80                  "description": "four years duration",
    81                  "data": "P4Y",
    82                  "valid": true
    83              },
    84              {
    85                  "description": "zero time, in seconds",
    86                  "data": "PT0S",
    87                  "valid": true
    88              },
    89              {
    90                  "description": "zero time, in days",
    91                  "data": "P0D",
    92                  "valid": true
    93              },
    94              {
    95                  "description": "one month duration",
    96                  "data": "P1M",
    97                  "valid": true
    98              },
    99              {
   100                  "description": "one minute duration",
   101                  "data": "PT1M",
   102                  "valid": true
   103              },
   104              {
   105                  "description": "one and a half days, in hours",
   106                  "data": "PT36H",
   107                  "valid": true
   108              },
   109              {
   110                  "description": "one and a half days, in days and hours",
   111                  "data": "P1DT12H",
   112                  "valid": true
   113              },
   114              {
   115                  "description": "two weeks",
   116                  "data": "P2W",
   117                  "valid": true
   118              },
   119              {
   120                  "description": "weeks cannot be combined with other units",
   121                  "data": "P1Y2W",
   122                  "valid": false
   123              },
   124              {
   125                  "description": "invalid non-ASCII '২' (a Bengali 2)",
   126                  "data": "P২Y",
   127                  "valid": false
   128              },
   129              {
   130                  "description": "element without unit",
   131                  "data": "P1",
   132                  "valid": false
   133              }
   134          ]
   135      }
   136  ]