Repository navigation
docs(zarr-metadata): say that to_json returns arrays as tuples - #4608
Merged
d-v-b merged 3 commits intoNov 9, 2026
Merged
Conversation
The guide said `to_json` returns plain containers, while another section said it returns tuples. Each model's `to_json` docstring now says that every JSON array is a tuple, as the package's JSON types spell one, so the result does not compare equal to `json.loads` output, and points to comparing models instead. Prompted by refkv's report. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s#4608 Assisted-by: ClaudeCode:claude-opus-5-5
Documentation build overview
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a docs-only change that clarifies that
to_jsontuplizes JSON arrays. So the output document might not match exactly the input document[ x ] I'm a person
🤖 AI text below 🤖
Agent summary
The
to_jsondocstrings and the models guide now say whatto_jsonreturns: a copy in which each JSON array is a tuple, as the package's JSON types spell an array, so it does not compare equal to whatjson.loadsreturns. They point to comparing models instead. The guide had saidto_jsonreturns plain containers.A downstream user (refkv) reported that
ZarrV3ArrayMetadata.from_json(doc).to_json() == docis false and thatisinstance(x, list)checks on the result fail. Tuples are deliberate: every JSON TypedDict in the package declares arrays astuple[...], andto_jsonreturns what its type declares, as pydantic'smodel_dump()keeps tuple fields as tuples. The docs were what was wrong.to_jsondocstrings (v3 array, group, consolidated metadata; v2 array, group,.zmetadata) say each array is a tuple and each object a newdict, and point tofrom_json(document) == modelfor comparison.docs/models.mdreplaces "to_jsonreturns plain containers" with the same explanation, noting that model comparison also treats an omitted default as equal to the default written out.The agent rebased the branch onto
mainafter #4605 split the landing page into guide pages; the sentence it corrects moved fromdocs/index.mdtodocs/models.md.just checkinpackages/zarr-metadatapasses.🤖 Generated with Claude Code