{
  "$comment": "https://minecraft.fandom.com/wiki/Recipe#JSON_format",
  "$id": "https://json.schemastore.org/minecraft-recipe.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:blasting"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a blast furnace.",
        "anyOf": [
          {
            "$ref": "#/definitions/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/definitions/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/definitions/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:campfire_cooking"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a campfire.",
        "anyOf": [
          {
            "$ref": "#/definitions/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/definitions/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/definitions/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:crafting_shaped"
          }
        }
      },
      "then": {
        "description": "Represents a shaped crafting recipe in a crafting table.",
        "anyOf": [
          {
            "$ref": "#/definitions/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/definitions/commonRecipeCategory"
          }
        ],
        "properties": {
          "pattern": {
            "description": "A list of single-character keys used to describe a pattern for shaped crafting.",
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 3
            },
            "maxItems": 3
          },
          "key": {
            "title": "key",
            "description": "All keys used for this shaped crafting recipe.",
            "additionalProperties": {
              "type": ["object", "array"],
              "description": "The ingredient corresponding to this key.",
              "properties": {
                "item": {
                  "description": "An item ID.",
                  "type": "string"
                },
                "tag": {
                  "description": "An item tag.",
                  "type": "string"
                }
              },
              "items": {
                "properties": {
                  "item": {
                    "description": "An item ID.",
                    "type": "string"
                  },
                  "tag": {
                    "description": "An item tag.",
                    "type": "string"
                  }
                }
              }
            }
          },
          "result": {
            "$ref": "#/definitions/result"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:crafting_shapeless"
          }
        }
      },
      "then": {
        "description": "Represents a shapeless crafting recipe in a crafting table.",
        "anyOf": [
          {
            "$ref": "#/definitions/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/definitions/commonRecipeCategory"
          }
        ],
        "properties": {
          "ingredients": {
            "description": "A list of entries for this shapeless crafting recipe.",
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "title": "ingredient",
                  "description": "An entry made of a single ingredient.",
                  "type": "object",
                  "$ref": "#/definitions/ingredient"
                },
                {
                  "description": "An entry made of a list of acceptable ingredients.",
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 9,
                  "items": {
                    "$ref": "#/definitions/ingredient"
                  }
                }
              ]
            }
          },
          "result": {
            "$ref": "#/definitions/result"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:smelting"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a furnace.",
        "anyOf": [
          {
            "$ref": "#/definitions/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/definitions/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/definitions/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:smithing"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a smithing table.",
        "$ref": "#/definitions/tagsCommonToAllRecipes",
        "properties": {
          "base": {
            "title": "base",
            "description": "Ingredient specifying an item to be upgraded.",
            "$ref": "#/definitions/item"
          },
          "addition": {
            "title": "addition",
            "$ref": "#/definitions/item"
          },
          "result": {
            "title": "result",
            "type": "object"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:smoking"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a smoker.",
        "anyOf": [
          {
            "$ref": "#/definitions/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/definitions/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/definitions/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:stonecutting"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a stonecutter.",
        "$ref": "#/definitions/tagsCommonToAllRecipes",
        "oneOf": [
          {
            "title": "ingredient",
            "description": "The ingredient for the recipe.",
            "$ref": "#/definitions/item"
          },
          {
            "title": "ingredient",
            "description": "The list of ingredients for the recipe.",
            "type": "array",
            "items": {
              "title": "ingredient",
              "$ref": "#/definitions/item"
            }
          }
        ],
        "properties": {
          "result": {
            "description": "An item ID. The output item of the recipe.",
            "type": "string"
          },
          "count": {
            "description": "The amount of the output item.",
            "type": "integer"
          }
        }
      }
    }
  ],
  "definitions": {
    "item": {
      "type": "object",
      "properties": {
        "item": {
          "description": "An item ID.",
          "type": "string"
        },
        "tag": {
          "description": "An item tag.",
          "type": "string"
        }
      }
    },
    "ingredient": {
      "title": "ingredient",
      "description": "An acceptable ingredient.",
      "type": "object",
      "$ref": "#/definitions/item"
    },
    "tagsCommonToAllRecipes": {
      "type": "object",
      "properties": {
        "type": {
          "description": "A namespaced ID indicating the type of serializer of the recipe.",
          "type": "string"
        },
        "group": {
          "description": "A string identifier. Used to group multiple recipes together in the recipe book.",
          "type": "string"
        },
        "show_notification": {
          "description": "If a notification is shown when the recipe is unlocked.",
          "type": "boolean"
        }
      }
    },
    "tagsCommonToAllCookingRecipes": {
      "type": "object",
      "properties": {
        "ingredient": {
          "title": "ingredients",
          "description": "The ingredients.",
          "type": ["object", "array"],
          "$ref": "#/definitions/ingredient",
          "items": {
            "$ref": "#/definitions/ingredient"
          }
        },
        "result": {
          "description": "An item ID. The output item of the recipe.",
          "type": "string"
        },
        "experience": {
          "description": "The output experience of the recipe.",
          "type": "number"
        },
        "cookingtime": {
          "description": "The cook time of the recipe in ticks.",
          "type": "integer"
        }
      }
    },
    "commonRecipeCategory": {
      "title": "category",
      "description": "Category of common recipes (in recipe book).",
      "type": "object",
      "properties": {
        "category": {
          "type": "string",
          "enum": ["building", "redstone", "equipment", "misc"]
        }
      }
    },
    "cookingRecipeCategory": {
      "title": "category",
      "description": "Category of cooking recipes (in recipe book).",
      "type": "object",
      "properties": {
        "category": {
          "type": "string",
          "enum": ["food", "blocks", "misc "]
        }
      }
    },
    "result": {
      "title": "result",
      "description": "The output item of the recipe.",
      "type": "object",
      "properties": {
        "count": {
          "description": "The amount of the item.",
          "type": "integer",
          "default": 1
        },
        "item": {
          "description": "An item ID.",
          "type": "string"
        }
      }
    }
  },
  "description": "Configuration file defining a recipe for a data pack for Minecraft.",
  "properties": {
    "type": {
      "description": "The type of recipe.",
      "type": "string",
      "enum": [
        "minecraft:blasting",
        "minecraft:campfire_cooking",
        "minecraft:crafting_shaped",
        "minecraft:crafting_shapeless",
        "minecraft:smelting",
        "minecraft:smithing",
        "minecraft:smoking",
        "minecraft:stonecutting"
      ]
    }
  },
  "title": "minecraft data pack recipe",
  "type": "object"
}