Repository navigation
feat(toon): implement TOON 4.4 and fix list-form nested objects - #227
Merged
Merged
Conversation
Rebuild the encoder and decoder on the reference implementation's algorithms (toon-format/toon-python@91413d14, MIT) so the module emits and reads the current format. The vendored spec 4.4 fixtures pass 564/564 (was 359/564), and the conformance baseline is empty. Fixes #188 as part of the rebuild: the list form writes an item's first key on the hyphen line ("- d:") and its decoder rebuilds the nested block, so [{'d': {}}] and arrays of objects with differently-keyed sub-objects round-trip instead of dropping data or raising. The spec removed the pre-4.0 [#N] length marker: encoding with lengthMarker now raises ValueError. Values outside the JSON data model (for example a callable) raise TypeError instead of encoding as null, matching the reference. Raise the bench-toon pin to the spec 4.4 commit and bump toon to 0.6.0. Fixes #184
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.
What
Bring
toon/to TOON 4.4 and close #188 as part of the rebuild.toon-format/toon-python@91413d14, MIT; attributed in the module docstring).toon/conformance_baseline.jsonis empty.[{'d': {}}]encodes as- d:and decodes back instead of droppingd, and arrays of objects with differently-keyed sub-objects decode their own encoder output. Item headers put the first key on the hyphen line, matching the reference.lengthMarkerwas removed by the specification: encoders never emit[#N], decoders reject it, and passing the option raisesValueError(migration note in the docs).TypeErrorinstead of silently encoding asnull, matching the reference andjson.dumps.bench-toonpin raised totoon-python@91413d14(spec 4.4).toonbumped to 0.6.0;manifest.jsonregenerated.Verification
pytest toon --ignore-glob="*/test_*_benchmark.py": 148 passed, against both the previously pinned reference and the 4.4 reference.pre-commit run --all-files: ruff, ruff-format, ty, complexipy pass.zerodep version-check: all modules up-to-date.Docs (module page, benchmark page, changelog; EN and ZH) are committed on
docs_en/docs_zh.Fixes #184
Fixes #188
AI was used to assist with this change.