88from zarr_metadata .v3 ._common import MetadataFieldV3
99
1010
11- class ExtraFieldV3 (TypedDict , extra_items = object ): # type: ignore[call-arg]
11+ class ExtensionFieldV3 (TypedDict , extra_items = object ): # type: ignore[call-arg]
1212 """
13- Extra field on a v3 array metadata document.
14-
15- Extras must include `must_understand: false` and may carry arbitrary
16- additional JSON data.
13+ Required shape of any extension field on a v3 metadata document.
14+
15+ The Zarr v3 spec permits extra keys on array and group metadata
16+ documents, provided each value is an object with `must_understand`
17+ set to `False`. This TypedDict captures that constraint and is used
18+ as the `extra_items=` parameter on `ArrayMetadataV3` and `GroupMetadataV3`.
19+
20+ Spec interpretation: this type follows the original Zarr v3.0 reading
21+ of the spec, under which any object with `must_understand: false` is a
22+ valid extension field. The v3.1 spec rewrite added language requiring
23+ extension fields to also include a `name: str` key (the "Extension
24+ definition" form). Under the strict v3.1 reading, real-world extension
25+ fields written by zarr-python and zarrs (notably `consolidated_metadata`,
26+ which has no `name` field) are out of spec. The community consensus at
27+ the time of writing is that this is a regression to be reverted; this
28+ package models the v3.0 / pre-revert interpretation. See
29+ https://github.com/zarr-developers/zarr-specs/issues/371 for the
30+ ongoing discussion.
1731 """
1832
1933 must_understand : Literal [False ]
2034
2135
22- class ArrayMetadataV3 (TypedDict , extra_items = ExtraFieldV3 ): # type: ignore[call-arg]
36+ class ArrayMetadataV3 (TypedDict , extra_items = ExtensionFieldV3 ): # type: ignore[call-arg]
2337 """
2438 Zarr v3 array metadata document (the `zarr.json` content for an array).
2539
26- Extra keys are permitted if they conform to `ExtraFieldV3 `.
40+ Extra keys are permitted if they conform to `ExtensionFieldV3 `.
2741
2842 See https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html#array-metadata
2943 """
@@ -43,5 +57,5 @@ class ArrayMetadataV3(TypedDict, extra_items=ExtraFieldV3): # type: ignore[call
4357
4458__all__ = [
4559 "ArrayMetadataV3" ,
46- "ExtraFieldV3 " ,
60+ "ExtensionFieldV3 " ,
4761]
0 commit comments