TandoorRecipes / recipes

Application for managing recipes, planning meals, building shopping lists and much much more!
https://docs.tandoor.dev
Other
5.35k stars 563 forks source link

Improve json-ld import #3253

Closed emouty closed 1 month ago

emouty commented 1 month ago

Is your feature request related to a problem? Please describe.

Hello, I'm using llms to structure unstructured recipes into the json-ld recipe format then import them in tandoor. The issue is that when importing a recipe in json-ld using the source tab, if this recipe have multiple HowToSection it result in a single step and if one of the HowToSection have an element in itemListElement of type recipe it is just ignored.

recipe example:

{
  "@context": "http://schema.org/",
  "@type": "Recipe",
  "name": "Victoria Sponge",
  "recipeIngredient": [
    "200g sugar",
    "200g butter",
    "4 eggs",
    "200g flour",
    "1 tsp baking powder",
    "2 tbsp milk"
  ],
  "recipeInstructions": [
    {
      "@type": "HowToSection",
      "name": "Sponge",
      "itemListElement": [
        {
          "@type": "HowToStep",
          "text": "Preheat oven to 180C."
        },
        {
          "@type": "HowToStep",
          "text": "Mix sugar and butter."
        }
      ]
    },
    {
        "@type": "HowToSection",
        "name": "Bake",
        "itemListElement": [
          {
            "@type": "HowToStep",
            "text": "Put the sponge in the hoven for 20 minutes"
          }
        ]
      },
    {
      "@type": "HowToSection",
      "name": "Filling",
      "itemListElement": [
        {
          "@type": "Recipe",
          "name": "Filling",
          "recipeIngredient": ["100g jam", "100g cream"],
          "recipeInstructions": [
            {
              "@type": "HowToStep",
              "text": "Spread jam on one sponge."
            }
          ]
        }
      ]
    }
  ]
}

Describe the solution you'd like

I would expect that each HowToSection result in a different step in tandoor and when the HowToSection.itemListElement contains an item of type recipe its turn it into a step like HowToSection and the ingredients listed in it would end up being ingredients of the step.

Describe alternatives you've considered

I originally wanted to target the default tandoor recipes format but I couldn't find a clear schema of it and import for default tandoor format require to compress the file into a zip archive.

Additional context

No response

smilerz commented 1 month ago

Sites do not use multiple HowTo steps in a consistent manner.