ValidationError for valid smithing_transform recipe
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 53/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 7
- Fork
- 10
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của hexdoc-dev/hexdoc
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
hexdoc-dev/hexdoc#109 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
hexdoc-dev/hexdoc#108 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
hexdoc-dev/hexdoc#90 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
hexdoc-dev/hexdoc#106 ·
-
Support Toki PonaĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
hexdoc-dev/hexdoc#105 ·
Tất cả issue của hexdoc-dev/hexdoc
Issue tương tự
-
wr.dynamodb.read_items returns [{}] for a single partition value that does not existCó thể đã có người làm @auraseb đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
aws/aws-sdk-pandas#3520 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
requires triage typing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sqlalchemy/sqlalchemy#13704 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Edit tool converts CRLF files to LFCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
huggingface/tau#774 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
show ignores the row limit when a column or table name contains "limit"Có thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
What happened to `check.py`?Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
linebender/resvg#1179 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày