Skip to content

Commit 13c4473

Browse files
vup903claude
andcommitted
docs: link msgspec symbols via its inventory (zarr-developers#3285)
Adds msgspec's Sphinx inventory so the json_parse docstrings can reference msgspec.convert and msgspec.ValidationError as real cross-references instead of inert literals. Verified the inventory is served at msgspec.dev (the jcristharif.com path in the package metadata is stale) and that both symbols resolve in it. Same-module names stay plain literals: zarr.core.json_parse is internal and not rendered in the API reference, so a cross-reference to it would not resolve and would fail `mkdocs build --strict`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent c829acd commit 13c4473

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎mkdocs.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ plugins:
194194
- https://docs.xarray.dev/en/stable/objects.inv
195195
- https://numpy.org/doc/stable/objects.inv
196196
- https://numcodecs.readthedocs.io/en/stable/objects.inv
197+
- https://msgspec.dev/objects.inv
197198
- https://developmentseed.org/obstore/latest/objects.inv
198199
- https://filesystem-spec.readthedocs.io/en/latest/objects.inv
199200
- https://requests.readthedocs.io/en/latest/objects.inv

‎src/zarr/core/json_parse.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Helpers for validating JSON-decoded metadata.
22
3-
Most JSON metadata validation is delegated to ``msgspec.convert``, which
4-
handles the type coercions Zarr needs (``Literal`` membership, ``int``/``bool``
5-
strictness, list-to-tuple, ``TypedDict`` with ``NotRequired``). ``convert``
6-
is a thin wrapper that translates ``msgspec.ValidationError`` into the
3+
Most JSON metadata validation is delegated to
4+
[`msgspec.convert`][msgspec.convert], which handles the type coercions Zarr
5+
needs (``Literal`` membership, ``int``/``bool`` strictness, list-to-tuple,
6+
``TypedDict`` with ``NotRequired``). ``convert`` is a thin wrapper that
7+
translates [`msgspec.ValidationError`][msgspec.ValidationError] into the
78
``TypeError`` the rest of the codebase already raises.
89
910
msgspec cannot handle two things in Zarr's metadata types:
@@ -45,9 +46,10 @@ def _type_name(type_: Any) -> str:
4546

4647

4748
def convert(value: object, type_: Any, *, strict: bool = True) -> Any:
48-
"""Validate and coerce ``value`` against ``type_`` via ``msgspec.convert``.
49+
"""Validate and coerce ``value`` against ``type_`` via [`msgspec.convert`][msgspec.convert].
4950
50-
On a mismatch msgspec raises ``msgspec.ValidationError``; this re-raises
51+
On a mismatch msgspec raises
52+
[`msgspec.ValidationError`][msgspec.ValidationError]; this re-raises
5153
a plain, field-agnostic ``ValueError`` naming the expected type, so callers
5254
can add their own field context (see ``parse_field``).
5355
"""

0 commit comments

Comments
 (0)