Repository navigation
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 <noreply@anthropic.com>
Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
🤖 AI text below 🤖
The
to_jsondocstrings and the 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.Why
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[...](covariant, unlikelist), andto_jsonreturns what its type declares, as pydantic'smodel_dump()keeps tuple fields as tuples. What was wrong is the docs:docs/index.mdsaidto_jsonreturns plain containers, while a later section said it returns tuples, and the docstrings only said "refined".Changes
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/index.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.just checkpassed locally.🤖 Generated with Claude Code