Skip to content

Fix to_json_representation_fast to not rely on second-chance external…#133

Merged
jamadden merged 3 commits into
masterfrom
better-to-json-rep
May 7, 2026
Merged

Fix to_json_representation_fast to not rely on second-chance external…#133
jamadden merged 3 commits into
masterfrom
better-to-json-rep

Conversation

@jamadden
Copy link
Copy Markdown
Member

@jamadden jamadden commented May 7, 2026

…ization; add a sorted variant; add some type annotations; improve docs.

…ization; add a sorted variant; add some type annotations; improve docs.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the externalization “representation” helpers to make the JSON “fast” path properly externalize objects before dumping, adds a deterministic (sorted-keys) JSON convenience API, and improves typing/docs around these APIs.

Changes:

  • Refactor representation dumping through a shared helper (_to_external_representation) and update to_json_representation_fast to externalize first.
  • Add to_json_representation_sorted and export it publicly.
  • Improve docstrings and documentation describing the JSON representer and convenience variants.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/nti/externalization/representation.py Adds shared dump helper, introduces sorted JSON convenience function, updates “fast” JSON path, and improves representer docstrings/typing.
src/nti/externalization/init.py Re-exports to_json_representation_sorted as part of the public API.
docs/basics.rst Documents the JSON convenience variants and shows usage examples.
CHANGES.rst Notes the new sorted variant and the behavioral change to the “fast” variant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/nti/externalization/representation.py Outdated
Comment thread src/nti/externalization/representation.py
Comment thread src/nti/externalization/representation.py
Comment thread docs/basics.rst Outdated
jamadden and others added 2 commits May 7, 2026 11:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jamadden jamadden merged commit 822803e into master May 7, 2026
18 checks passed
@jamadden jamadden deleted the better-to-json-rep branch May 7, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants