ValidationError for valid smithing_transform recipe
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 7
- 派生
- 10
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hexdoc-dev/hexdoc 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
hexdoc-dev/hexdoc#109 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
hexdoc-dev/hexdoc#108 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
hexdoc-dev/hexdoc#90 ·
-
难度 3/5 1-2 天 新手友好度 55/100
hexdoc-dev/hexdoc#106 ·
-
难度 3/5 1-2 天 新手友好度 55/100
hexdoc-dev/hexdoc#105 ·
查看 hexdoc-dev/hexdoc 的全部 Issue
相似的 Issue
-
bug documentation
难度 2/5 1-3 小时 新手友好度 78/100
awslabs/visual-asset-management-system#514 ·
维护者通常 1 天内回复
-
backend bug spec:REQ-053
难度 2/5 1-3 小时 新手友好度 66/100
nolte/kamerplanter#2547 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
EleutherAI/lm-evaluation-harness#4425 ·
维护者通常 1 天内回复
-
Gemini: respect PLANNING_DISABLED=1 in lifecycle context hooks可能已有人在做 @AmariAugustin 今天认领。 未关闭bug good first issue help wanted
难度 2/5 1-3 小时 新手友好度 87/100
OthmanAdi/planning-with-files#329 · 1 条评论 ·
维护者通常 1 天内回复
-
wr.dynamodb.read_items returns [{}] for a single partition value that does not exist可能已有人在做 @auraseb 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
aws/aws-sdk-pandas#3520 ·
维护者通常 2 天内回复