k8s.io/kube-openapi@v0.0.0-20240228011516-70dd3763d340/pkg/validation/validate/fixtures/jsonschema_suite/required.json (about)

     1  [
     2      {
     3          "description": "required validation",
     4          "schema": {
     5              "properties": {
     6                  "foo": {},
     7                  "bar": {}
     8              },
     9              "required": ["foo"]
    10          },
    11          "tests": [
    12              {
    13                  "description": "present required property is valid",
    14                  "data": {"foo": 1},
    15                  "valid": true
    16              },
    17              {
    18                  "description": "non-present required property is invalid",
    19                  "data": {"bar": 1},
    20                  "valid": false
    21              },
    22              {
    23                  "description": "ignores arrays",
    24                  "data": [],
    25                  "valid": true
    26              },
    27              {
    28                  "description": "ignores strings",
    29                  "data": "",
    30                  "valid": true
    31              },
    32              {
    33                  "description": "ignores other non-objects",
    34                  "data": 12,
    35                  "valid": true
    36              }
    37          ]
    38      },
    39      {
    40          "description": "required default validation",
    41          "schema": {
    42              "properties": {
    43                  "foo": {}
    44              }
    45          },
    46          "tests": [
    47              {
    48                  "description": "not required by default",
    49                  "data": {},
    50                  "valid": true
    51              }
    52          ]
    53      }
    54  ]