ValidationError for valid smithing_transform recipe
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 53/100
Línea de trabajo
Start with the SmithingTransformRecipe validation reached through SmithingPage and inspect how recipe ingredients and results are modeled. Reproduce the failure using the linked smithing recipe examples, including object and array forms for base, addition, and template. Done when valid smithing_transform recipes validate and the reported web book build succeeds.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Using hexdoc 2.0.0rc1 (with Hex Casting 1.21.1 dev-53)
hexdoc fails to build the web book because of a ValidationError.
Example run:
https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584
Files which (I think) are failing the validation:
https://github.com/hauveli/fishcasting/blob/main/src/common/main/resources/data/fishcasting/recipe/shepherds_rod_smithing.json
https://github.com/hauveli/fishcasting/blob/main/src/common/main/resources/data/fishcasting/recipe/blessed_bobber_smithing.json
https://github.com/hauveli/fishcasting/blob/main/src/common/main/resources/data/fishcasting/recipe/crystal_casting_rod_smithing.json (Edit: I think this one may also be relevant, as it is also referenced.)
(Edit: These are the patchouli pages affected)
https://github.com/hauveli/fishcasting/blob/main/src/common/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/items/casting_rod.json
https://github.com/hauveli/fishcasting/blob/main/src/common/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/greatwork/fanciful_fishing.json
Possibly of note here, is that base, addition and template can be an Object or an Array of Objects, and still work in game.
Based on Misode, for 26.3 this becomes a String or an Array (of Strings).
Excerpts for the field "base" to show more clearly what I am referring to:
(from shepherds_rod_smithing.json)
"base": {
"item": "tide:crystal_fishing_rod"
},
(from blessed_bobber_smithing.json)
"base": [
{
"item": "tide:amethyst_bobber"
}
],
The error from the example run:
│ /home/runner/work/fishcasting/fishcasting/.venv/lib/python3.12/site-packages │
│ /hexdoc/cli/ci.py:51 in build │
│ │
│ 48 │ │ pages_url = get_pages_url(env.repo) │
│ 49 │ os.environ["GITHUB_PAGES_URL"] = pages_url │
│ 50 │ │
│ ❱ 51 │ site_path = hexdoc_app.build( │
│ 52 │ │ Path("_site/src/docs"), │
│ 53 │ │ clean=True, │
│ 54 │ │ branch=env.branch, │
│ │
│ /home/runner/work/fishcasting/fishcasting/.venv/lib/python3.12/site-packages │
│ /hexdoc/cli/app.py:264 in build │
│ │
│ [261](https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584#step:6:275) │ │ │ │ │ i18n=i18n, │
│ [262](https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584#step:6:276) │ │ │ │ │ all_metadata=all_metadata, │
│ [263](https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584#step:6:277) │ │ │ │ ) as context: │
│ ❱ [264](https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584#step:6:278) │ │ │ │ │ book = book_plugin.validate_book(book_data, contex │
│ [265](https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584#step:6:279) │ │ │ │ books.append( │
│ [266](https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584#step:6:280) │ │ │ │ │ LoadedBookInfo( │
│ [267](https://github.com/hauveli/fishcasting/actions/runs/38210665289/job/114683851584#step:6:281) │ │ │ │ │ │ language=language, │
│ │
│ /home/runner/work/fishcasting/fishcasting/.venv/lib/python3.12/site-packages │
│ /hexdoc/_hooks.py:169 in validate_book │
│ │
│ 166 │ │ │
│ 167 │ │ book = Book.model_validate(book_data, context=cast_context(con │
│ 168 │ │ book._load_categories(context, book_ctx) │
│ ❱ 169 │ │ book._load_entries(context, book_ctx, loader) │
│ 170 │ │ │
│ 171 │ │ return book │
│ 172 │
│ │
│ /home/runner/work/fishcasting/fishcasting/.venv/lib/python3.12/site-packages │
│ /hexdoc/patchouli/book.py:130 in _load_entries │
│ │
│ 127 │ │ │ folder="entries", │
│ 128 │ │ │ use_resource_pack=self.use_resource_pack, │
│ 129 │ │ ): │
│ ❱ 130 │ │ │ entry = Entry.load(resource_dir, id, data, cast_context(co │
│ 131 │ │ │ if not entry.is_flag_enabled: │
│ 132 │ │ │ │ logger.info(f"Skipping entry {id} due to disabled flag │
│ 133 │ │ │ │ continue │
│ │
│ /home/runner/work/fishcasting/fishcasting/.venv/lib/python3.12/site-packages │
│ /hexdoc/model/id.py:35 in load │
│ │
│ 32 │ │ context: dict[str, Any], │
│ 33 │ ) -> Self: │
│ 34 │ │ logger.log(TRACE, f"Load {cls} at {id}") │
│ ❱ 35 │ │ return cls.model_validate( │
│ 36 │ │ │ data | {"id": id, "resource_dir": resource_dir}, │
│ 37 │ │ │ context=context, │
│ 38 │ │ ) │
│ │
│ /home/runner/work/fishcasting/fishcasting/.venv/lib/python3.12/site-packages │
│ /pydantic/main.py:732 in model_validate │
│ │
│ 729 │ │ │ │ code='validate-by-alias-and-name-false', │
│ 730 │ │ │ ) │
│ 731 │ │ │
│ ❱ 732 │ │ return cls.__pydantic_validator__.validate_python( │
│ 733 │ │ │ obj, │
│ 734 │ │ │ strict=strict, │
│ 735 │ │ │ extra=extra, │
╰──────────────────────────────────────────────────────────────────────────────╯
ValidationError: 2 validation errors for Entry
pages.2.Page
Failed to match union <class 'hexdoc.patchouli.page.abstract_pages.Page'>: No
match found
Types: <class 'hexdoc.patchouli.page.pages.SmithingPage'>
Value: {'type': 'patchouli:smithing', 'recipe':
'fishcasting:crystal_casting_rod_smithing', 'text':
'fishcasting.page.casting_rod.smithing', '__resolved': True}
Tag: type=patchouli:smithing [type=TaggedUnionMatchErrorGroup,
input_value={'type': 'patchouli:smith...e.casting_rod.smithing'},
input_type=dict]
pages.2.Page.SmithingPage
ValidationError: 2 validation errors for SmithingPage
recipe.SmithingRecipe
Failed to match union <class
'hexdoc.minecraft.recipe.recipes.SmithingRecipe'>: No match found
Types: <class 'hexdoc.minecraft.recipe.recipes.SmithingTransformRecipe'>
Value: {'type': 'minecraft:smithing_transform', 'addition': {'item':
'hexcasting:charged_amethyst', '__resolved': True}, 'base': [{'item':
'minecraft:fishing_rod'}, {'item': 'tide:stone_fishing_rod'}, {'item':
'tide:iron_fishing_rod'}, {'item': 'tide:golden_fishing_rod'}], 'result':
{'count': 1, 'id': 'tide:crystal_fishing_rod'}, 'template': {'tag': 'c:strings',
'__resolved': True}, 'id': fishcasting:crystal_casting_rod_smithing,
'resource_dir': PathResourceDir(external=False, reexport=True, required=True,
path=PosixPath('/home/runner/work/fishcasting/fishcasting/doc/../src/common/main
/resources'), archive=False), '__resolved': True}
Tag: type=minecraft:smithing_transform [type=TaggedUnionMatchErrorGroup,
input_value={'type': 'minecraft:smith...urces'), archive=False)},
input_type=dict]
recipe.SmithingRecipe.SmithingTransformRecipe
ValidationError: 5 validation errors for SmithingTransformRecipe
base
Input should be a valid dictionary or instance of ItemIngredient
[type=model_type, input_value=[{'item':
'minecraft:fish...de:golden_fishing_rod'}], input_type=list]
For further information visit https://errors.pydantic.dev/2.13/v/model_type
result.function-after[_set_name(),
function-wrap[_wrap_root_load_from_id()]].item
Field required [type=missing, input_value={'count': 1, 'id':
'tide:crystal_fishing_rod'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.13/v/missing
result.function-after[_set_name(),
function-wrap[_wrap_root_load_from_id()]].count
Extra inputs are not permitted [type=extra_forbidden, input_value=1,
input_type=int]
For further information visit
https://errors.pydantic.dev/2.13/v/extra_forbidden
result.function-after[_set_name(), function-wrap[_wrap_root_load_from_id()]].url
Field required [type=missing, input_value={'count': 1, 'id':
'tide:crystal_fishing_rod'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.13/v/missing
result.function-after[_set_name(),
function-wrap[_wrap_root_load_from_id()]].count
Extra inputs are not permitted [type=extra_forbidden, input_value=1,
input_type=int]
For further information visit
https://errors.pydantic.dev/2.13/v/extra_forbidden [type=TaggedUnionMatchError,
input_value={'type': 'minecraft:smith...urces'), archive=False)},
input_type=dict] [type=TaggedUnionMatchError, input_value={'type':
'patchouli:smith...e.casting_rod.smithing'}, input_type=dict]
Error: Process completed with exit code 1.
- Lenguaje dominante
- Python
- Estrellas
- 7
- Forks
- 10
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de hexdoc-dev/hexdoc
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
hexdoc-dev/hexdoc#109 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
hexdoc-dev/hexdoc#108 ·
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
hexdoc-dev/hexdoc#90 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
hexdoc-dev/hexdoc#106 ·
-
Support Toki PonaAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
hexdoc-dev/hexdoc#105 ·
Todos los issues de hexdoc-dev/hexdoc
Issues similares
-
get_page_thumbnail modifies cached page images, affecting later thumbnails and picture exportsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
docling-project/docling-mcp#147 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
autowarefoundation/autoware_carla_scenario#405 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mohitmishra786/readprism#322 ·
Los mantenedores suelen responder en 1 día