[
  {
    "name": "draft4 $schema",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#"
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema"
    }
  },
  {
    "name": "draft4 id to $id",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "http://example.com/schema"
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "http://example.com/schema"
    }
  },
  {
    "name": "draft4 $id with # to $anchor",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "$id": "#tag"
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$anchor": "tag"
    }
  },
  {
    "name": "draft4 exclusiveMinimum to minimum",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "minimum": 5,
      "exclusiveMinimum": true
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "exclusiveMinimum": 5
    }
  },
  {
    "name": "draft4 exclusiveMaximum to maximum",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "maximum": 5,
      "exclusiveMaximum": true
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "exclusiveMaximum": 5
    }
  },
  {
    "name": "draft4 exclusiveMinimum false",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "minimum": 5,
      "exclusiveMinimum": false
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "minimum": 5
    }
  },
  {
    "name": "draft4 exclusiveMaximum false",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "maximum": 5,
      "exclusiveMaximum": false
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "maximum": 5
    }
  },
  {
    "name": "draft4 definitions",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "properties": {
        "foo": {
          "$ref": "#/definitions/foo"
        }
      },
      "definitions": {
        "foo": { "type": "string" }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "properties": {
        "foo": {
          "$ref": "#/$defs/foo"
        }
      },
      "$defs": {
        "foo": { "type": "string" }
      }
    }
  },
  {
    "name": "true no metaschema",
    "schema": {},
    "expected": true
  },
  {
    "name": "true no metaschema",
    "schema": { "not": {} },
    "expected": false
  },
  {
    "name": "enum with one value",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "enum": [ "single-value" ]
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "const": "single-value"
    }
  },
  {
    "name": "dependencies to dependentRequired and dependentSchemas",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "dependencies": {
        "foo": { "type": "string" },
        "bar": false,
        "baz": true,
        "qux": [ "foo" ]
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "dependentSchemas": {
        "foo": { "type": "string" },
        "bar": false,
        "baz": true
      },
      "dependentRequired": {
        "qux": [ "foo" ]
      }
    }
  },
  {
    "name": "dependencies to dependentSchemas only",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "dependencies": {
        "foo": { "type": "string" },
        "bar": false,
        "baz": true
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "dependentSchemas": {
        "foo": { "type": "string" },
        "bar": false,
        "baz": true
      }
    }
  },
  {
    "name": "dependencies to dependentRequired only",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "dependencies": {
        "qux": [ "foo" ]
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "dependentRequired": {
        "qux": [ "foo" ]
      }
    }
  },
  {
    "name": "enum with multiple elements is preserved",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "enum": [ "foo", "bar" ]
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "enum": [ "foo", "bar" ]
    }
  },
  {
    "name": "properties with a not: {} schema",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "properties": {
        "foo": {
          "not": {}
        }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "properties": {
        "foo": false
      }
    }
  },
  {
    "name": "items to prefixItems within $ref",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "items": [
        { "type": "integer" },
        { "$ref": "#/items/0" }
      ]
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "prefixItems": [
        { "type": "integer" },
        { "$ref": "#/prefixItems/0" }
      ]
    }
  },
  {
    "name": "items not to prefixItems within $ref",
    "schema": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "items": { "type": "integer" },
      "properties": {
        "foo": { "$ref": "#/items" }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "items": { "type": "integer" },
      "properties": {
        "foo": { "$ref": "#/items" }
      }
    }
  }
]
