[
  {
    "description": "ignore if without then or else",
    "database": {
      "schemas": [
        {
          "if": {
            "const": 0
          },
          "$id": "if-then-else_0_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid when valid against lone if",
        "data": 0,
        "schema_id": "if-then-else_0_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "valid when invalid against lone if",
        "data": "hello",
        "schema_id": "if-then-else_0_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "ignore then without if",
    "database": {
      "schemas": [
        {
          "then": {
            "const": 0
          },
          "$id": "if-then-else_1_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid when valid against lone then",
        "data": 0,
        "schema_id": "if-then-else_1_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "valid when invalid against lone then",
        "data": "hello",
        "schema_id": "if-then-else_1_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "ignore else without if",
    "database": {
      "schemas": [
        {
          "else": {
            "const": 0
          },
          "$id": "if-then-else_2_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid when valid against lone else",
        "data": 0,
        "schema_id": "if-then-else_2_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "valid when invalid against lone else",
        "data": "hello",
        "schema_id": "if-then-else_2_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "if and then without else",
    "database": {
      "schemas": [
        {
          "if": {
            "exclusiveMaximum": 0
          },
          "then": {
            "minimum": -10
          },
          "$id": "if-then-else_3_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid through then",
        "data": -1,
        "schema_id": "if-then-else_3_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "invalid through then",
        "data": -100,
        "schema_id": "if-then-else_3_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "valid when if test fails",
        "data": 3,
        "schema_id": "if-then-else_3_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "if and else without then",
    "database": {
      "schemas": [
        {
          "if": {
            "exclusiveMaximum": 0
          },
          "else": {
            "multipleOf": 2
          },
          "$id": "if-then-else_4_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid when if test passes",
        "data": -1,
        "schema_id": "if-then-else_4_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "valid through else",
        "data": 4,
        "schema_id": "if-then-else_4_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "invalid through else",
        "data": 3,
        "schema_id": "if-then-else_4_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "validate against correct branch, then vs else",
    "database": {
      "schemas": [
        {
          "if": {
            "exclusiveMaximum": 0
          },
          "then": {
            "minimum": -10
          },
          "else": {
            "multipleOf": 2
          },
          "$id": "if-then-else_5_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid through then",
        "data": -1,
        "schema_id": "if-then-else_5_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "invalid through then",
        "data": -100,
        "schema_id": "if-then-else_5_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "valid through else",
        "data": 4,
        "schema_id": "if-then-else_5_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "invalid through else",
        "data": 3,
        "schema_id": "if-then-else_5_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "non-interference across combined schemas",
    "database": {
      "schemas": [
        {
          "allOf": [
            {
              "if": {
                "exclusiveMaximum": 0
              }
            },
            {
              "then": {
                "minimum": -10
              }
            },
            {
              "else": {
                "multipleOf": 2
              }
            }
          ],
          "$id": "if-then-else_6_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid, but would have been invalid through then",
        "data": -100,
        "schema_id": "if-then-else_6_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "valid, but would have been invalid through else",
        "data": 3,
        "schema_id": "if-then-else_6_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "if with boolean schema true",
    "database": {
      "schemas": [
        {
          "if": true,
          "then": {
            "const": "then"
          },
          "else": {
            "const": "else"
          },
          "$id": "if-then-else_7_0"
        }
      ]
    },
    "tests": [
      {
        "description": "boolean schema true in if always chooses the then path (valid)",
        "data": "then",
        "schema_id": "if-then-else_7_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "boolean schema true in if always chooses the then path (invalid)",
        "data": "else",
        "schema_id": "if-then-else_7_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "if with boolean schema false",
    "database": {
      "schemas": [
        {
          "if": false,
          "then": {
            "const": "then"
          },
          "else": {
            "const": "else"
          },
          "$id": "if-then-else_8_0"
        }
      ]
    },
    "tests": [
      {
        "description": "boolean schema false in if always chooses the else path (invalid)",
        "data": "then",
        "schema_id": "if-then-else_8_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "boolean schema false in if always chooses the else path (valid)",
        "data": "else",
        "schema_id": "if-then-else_8_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "if appears at the end when serialized (keyword processing sequence)",
    "database": {
      "schemas": [
        {
          "then": {
            "const": "yes"
          },
          "else": {
            "const": "other"
          },
          "if": {
            "maxLength": 4
          },
          "$id": "if-then-else_9_0"
        }
      ]
    },
    "tests": [
      {
        "description": "yes redirects to then and passes",
        "data": "yes",
        "schema_id": "if-then-else_9_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "other redirects to else and passes",
        "data": "other",
        "schema_id": "if-then-else_9_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "no redirects to then and fails",
        "data": "no",
        "schema_id": "if-then-else_9_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "invalid redirects to else and fails",
        "data": "invalid",
        "schema_id": "if-then-else_9_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "then: false fails when condition matches",
    "database": {
      "schemas": [
        {
          "if": {
            "const": 1
          },
          "then": false,
          "$id": "if-then-else_10_0"
        }
      ]
    },
    "tests": [
      {
        "description": "matches if → then=false → invalid",
        "data": 1,
        "schema_id": "if-then-else_10_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "does not match if → then ignored → valid",
        "data": 2,
        "schema_id": "if-then-else_10_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "else: false fails when condition does not match",
    "database": {
      "schemas": [
        {
          "if": {
            "const": 1
          },
          "else": false,
          "$id": "if-then-else_11_0"
        }
      ]
    },
    "tests": [
      {
        "description": "matches if → else ignored → valid",
        "data": 1,
        "schema_id": "if-then-else_11_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "does not match if → else executes → invalid",
        "data": 2,
        "schema_id": "if-then-else_11_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "extensible: true allows extra properties in if-then-else",
    "database": {
      "schemas": [
        {
          "if": {
            "properties": {
              "foo": {
                "const": 1
              }
            },
            "required": [
              "foo"
            ]
          },
          "then": {
            "properties": {
              "bar": {
                "const": 2
              }
            },
            "required": [
              "bar"
            ]
          },
          "extensible": true,
          "$id": "if-then-else_12_0"
        }
      ]
    },
    "tests": [
      {
        "description": "extra property is valid (matches if and then)",
        "data": {
          "foo": 1,
          "bar": 2,
          "extra": "prop"
        },
        "schema_id": "if-then-else_12_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "strict by default with if-then properties",
    "database": {
      "schemas": [
        {
          "if": {
            "properties": {
              "foo": {
                "const": 1
              }
            },
            "required": [
              "foo"
            ]
          },
          "then": {
            "properties": {
              "bar": {
                "const": 2
              }
            }
          },
          "$id": "if-then-else_13_0"
        }
      ]
    },
    "tests": [
      {
        "description": "valid match (foo + bar)",
        "data": {
          "foo": 1,
          "bar": 2
        },
        "schema_id": "if-then-else_13_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "fails on extra property z explicitly",
        "data": {
          "foo": 1,
          "bar": 2,
          "z": 3
        },
        "schema_id": "if-then-else_13_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  }
]