[
  {
    "name": "2019-09 official $schema to 2020-12",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "type": "object"
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object"
    }
  },
  {
    "name": "items array to prefixItems",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "items": [
        { "$ref": "#/$defs/foo" },
        { "$ref": "#/$defs/bar" }
      ]
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "prefixItems": [
        { "$ref": "#/$defs/foo" },
        { "$ref": "#/$defs/bar" }
      ]
    }
  },
  {
    "name": "items array with falsy additionalItems",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "additionalItems": false,
      "items": [
        { "$ref": "#/$defs/foo" },
        { "$ref": "#/$defs/bar" }
      ]
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "items": false,
      "prefixItems": [
        { "$ref": "#/$defs/foo" },
        { "$ref": "#/$defs/bar" }
      ]
    }
  },
  {
    "name": "items array with non-falsy additionalItems",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "additionalItems": { "$ref": "#/$defs/baz" },
      "items": [
        { "$ref": "#/$defs/foo" },
        { "$ref": "#/$defs/bar" }
      ]
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "items": { "$ref": "#/$defs/baz" },
      "prefixItems": [
        { "$ref": "#/$defs/foo" },
        { "$ref": "#/$defs/bar" }
      ]
    }
  },
  {
    "name": "true no metaschema",
    "schema": {},
    "expected": true
  },
  {
    "name": "true no metaschema",
    "schema": { "not": {} },
    "expected": false
  },
  {
    "name": "enum with one value",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "enum": [ "single-value" ]
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "const": "single-value"
    }
  },
  {
    "name": "enum with multiple elements is preserved",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/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": "https://json-schema.org/draft/2019-09/schema",
      "properties": {
        "foo": {
          "not": {}
        }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "properties": {
        "foo": false
      }
    }
  },
  {
    "name": "$recursiveRef with $recursiveAnchor: true",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "$recursiveAnchor": true,
      "additionalProperties": false,
      "properties": {
        "foo": { "$recursiveRef": "#" }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$dynamicAnchor": "anchor-452249d4fa018cdc5ec4b60924df6d0177fb65b9",
      "additionalProperties": false,
      "properties": {
        "foo": { "$dynamicRef": "#anchor-452249d4fa018cdc5ec4b60924df6d0177fb65b9" }
      }
    }
  },
  {
    "name": "$recursiveRef with $recursiveAnchor: false",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "$recursiveAnchor": false,
      "additionalProperties": false,
      "properties": {
        "foo": { "$recursiveRef": "#" }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "additionalProperties": false,
      "properties": {
        "foo": { "$dynamicRef": "#" }
      }
    }
  },
  {
    "name": "$recursiveRef without $recursiveAnchor",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "additionalProperties": false,
      "properties": {
        "foo": { "$recursiveRef": "#" }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "additionalProperties": false,
      "properties": {
        "foo": { "$dynamicRef": "#" }
      }
    }
  },
  {
    "name": "items to prefixItems within $ref",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/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": "https://json-schema.org/draft/2019-09/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" }
      }
    }
  },
  {
    "name": "additionalItems to items within $ref",
    "schema": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "items": [
        { "type": "string" }
      ],
      "additionalItems": { "type": "integer" },
      "properties": {
        "foo": { "$ref": "#/additionalItems" }
      }
    },
    "expected": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "prefixItems": [
        { "type": "string" }
      ],
      "items": { "type": "integer" },
      "properties": {
        "foo": { "$ref": "#/items" }
      }
    }
  }
]
