@toon-format/spec 1.3.3 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +15 -3
  3. package/SPEC.md +435 -102
  4. package/VERSIONING.md +1 -14
  5. package/package.json +1 -1
  6. package/tests/README.md +42 -28
  7. package/tests/fixtures/decode/arrays-nested.json +20 -20
  8. package/tests/fixtures/decode/arrays-primitive.json +14 -14
  9. package/tests/fixtures/decode/arrays-tabular.json +28 -5
  10. package/tests/fixtures/decode/blank-lines.json +14 -14
  11. package/tests/fixtures/decode/delimiters.json +46 -29
  12. package/tests/fixtures/decode/indentation-errors.json +16 -29
  13. package/tests/fixtures/decode/numbers.json +142 -0
  14. package/tests/fixtures/decode/objects.json +29 -29
  15. package/tests/fixtures/decode/path-expansion.json +173 -0
  16. package/tests/fixtures/decode/primitives.json +44 -75
  17. package/tests/fixtures/decode/root-form.json +17 -0
  18. package/tests/fixtures/decode/validation-errors.json +29 -9
  19. package/tests/fixtures/decode/whitespace.json +61 -0
  20. package/tests/fixtures/encode/arrays-nested.json +15 -15
  21. package/tests/fixtures/encode/arrays-objects.json +16 -16
  22. package/tests/fixtures/encode/arrays-primitive.json +14 -14
  23. package/tests/fixtures/encode/arrays-tabular.json +8 -8
  24. package/tests/fixtures/encode/delimiters.json +23 -23
  25. package/tests/fixtures/encode/key-folding.json +218 -0
  26. package/tests/fixtures/encode/objects.json +27 -27
  27. package/tests/fixtures/encode/options.json +1 -1
  28. package/tests/fixtures/encode/primitives.json +61 -36
  29. package/tests/fixtures/encode/whitespace.json +18 -3
  30. package/tests/fixtures.schema.json +20 -4
  31. package/tests/fixtures/encode/normalization.json +0 -107
package/CHANGELOG.md CHANGED
@@ -5,6 +5,34 @@ All notable changes to the TOON specification will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.5] - 2025-11-08
9
+
10
+ ### Added
11
+
12
+ - Optional key folding for encoders: `keyFolding="safe"` mode with `flattenDepth` control to collapse single-key object chains into dotted-path notation (§13.4)
13
+ - Optional path expansion for decoders: `expandPaths="safe"` mode to split dotted keys into nested objects, with conflict resolution tied to `strict` option (§13.4, §14.5)
14
+ - IdentifierSegment terminology and path separator definition (fixed to `"."` in v1.5) (§1.9)
15
+ - Deep-merge semantics for path expansion: recursive merge for objects, error on conflict when `strict=true`, last-write-wins (LWW) when `strict=false` (§13.4)
16
+
17
+ ### Changed
18
+
19
+ - Both new features default to OFF and are fully backward-compatible
20
+ - Safe-mode folding requires IdentifierSegment validation, collision avoidance, and no quoting
21
+
22
+ ## [1.4] - 2025-11-05
23
+
24
+ ### Changed
25
+
26
+ - Removed JavaScript-specific normalization details from specification; replaced with language-agnostic requirements (Section 3)
27
+ - Defined canonical number format for encoders: no exponent notation, no trailing zeros, no leading zeros except "0" (Section 2)
28
+ - Clarified decoder handling of exponent notation and out-of-range numbers (Section 2)
29
+ - Expanded `\w` regex notation to explicit character class `[A-Za-z0-9_]` for cross-language clarity (Section 7.3)
30
+ - Clarified non-strict mode tab handling as implementation-defined (Section 12)
31
+
32
+ ### Added
33
+
34
+ - Appendix G: Host Type Normalization Examples with guidance for Go, JavaScript, Python, and Rust implementations
35
+
8
36
  ## [1.3] - 2025-10-31
9
37
 
10
38
  ### Added
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # TOON Format Specification
2
2
 
3
- [![SPEC v1.3](https://img.shields.io/badge/spec-v1.3-lightgrey)](./SPEC.md)
4
- [![Tests](https://img.shields.io/badge/tests-306-green)](./tests/fixtures/)
3
+ [![SPEC v1.5](https://img.shields.io/badge/spec-v1.5-lightgrey)](./SPEC.md)
4
+ [![Tests](https://img.shields.io/badge/tests-323-green)](./tests/fixtures/)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6
6
 
7
7
  This repository contains the official specification for **Token-Oriented Object Notation (TOON)**, a compact, human-readable serialization format designed for passing structured data to Large Language Models with significantly reduced token usage.
@@ -10,12 +10,24 @@ This repository contains the official specification for **Token-Oriented Object
10
10
 
11
11
  [→ Read the full specification (SPEC.md)](./SPEC.md)
12
12
 
13
- - **Version:** 1.3 (2025-10-31)
13
+ - **Version:** 1.5 (2025-11-10)
14
14
  - **Status:** Working Draft
15
15
  - **License:** MIT
16
16
 
17
17
  The specification includes complete grammar (ABNF), encoding rules, validation requirements, and conformance criteria.
18
18
 
19
+ ### New in v1.5
20
+
21
+ - **Key Folding** (encode): Collapse nested single-key objects into compact dotted paths
22
+ - `{"a": {"b": {"c": 1}}}` → `a.b.c: 1`
23
+ - Opt-in via `keyFolding="safe"` with `flattenDepth` control
24
+ - **Path Expansion** (decode): Expand dotted keys back to nested objects
25
+ - `a.b.c: 1` → `{"a": {"b": {"c": 1}}}`
26
+ - Opt-in via `expandPaths="safe"` with deep-merge semantics
27
+
28
+ > [!NOTE]
29
+ > Both features are opt-in to maintain backward compatibility.
30
+
19
31
  ## What is TOON?
20
32
 
21
33
  **Token-Oriented Object Notation** is a compact, human-readable serialization format designed for passing structured data to Large Language Models with significantly reduced token usage. It's intended for LLM input, not output.