@toon-format/spec 1.3.0 → 1.3.2
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.
- package/CHANGELOG.md +0 -1
- package/CONTRIBUTING.md +67 -220
- package/SPEC.md +24 -5
- package/package.json +1 -1
- package/tests/fixtures/decode/arrays-nested.json +19 -0
- package/tests/fixtures/decode/arrays-primitive.json +24 -0
- package/tests/fixtures/decode/arrays-tabular.json +11 -0
- package/tests/fixtures/decode/indentation-errors.json +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
- Numeric precision requirements: JavaScript implementations SHOULD use `Number.toString()` precision (15-17 digits), all implementations MUST preserve round-trip fidelity (Section 2)
|
|
13
13
|
- RFC 5234 core rules (ALPHA, DIGIT, DQUOTE, HTAB, LF, SP) to ABNF grammar definitions (Section 6)
|
|
14
|
-
- Test case for repeating decimal precision (1/3) to validate round-trip behavior
|
|
15
14
|
|
|
16
15
|
## [1.2] - 2025-10-29
|
|
17
16
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,259 +1,106 @@
|
|
|
1
1
|
# Contributing to TOON Specification
|
|
2
2
|
|
|
3
|
-
Thanks for your interest in contributing
|
|
3
|
+
Thanks for your interest in contributing! This guide shows how to propose changes to the specification.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Quick Reference: What Process Do I Need?
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| Change Type | Examples | Process |
|
|
8
|
+
| ----------- | -------- | ------- |
|
|
9
|
+
| **Fixes** | Typos, grammar, broken links, clarifying wording | Direct PR |
|
|
10
|
+
| **Test Fixtures** | New test cases, edge case tests, validation tests | Direct PR (see [tests/README.md](./tests/README.md)) |
|
|
11
|
+
| **Minor Changes** | Spec clarifications that may affect implementations | Issue first → PR |
|
|
12
|
+
| **Major Changes** | New syntax, encoding rules, breaking changes | RFC process (see below) |
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
- [Before You Contribute](#before-you-contribute)
|
|
11
|
-
- [Proposing Changes](#proposing-changes)
|
|
12
|
-
- [RFC Process for Major Changes](#rfc-process-for-major-changes)
|
|
13
|
-
- [Specification Principles](#specification-principles)
|
|
14
|
-
- [Style Guidelines](#style-guidelines)
|
|
14
|
+
## Does My Change Need an RFC?
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
### Yes – RFC Required
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Changes that affect compatibility or core behavior need community discussion:
|
|
19
19
|
|
|
20
|
-
Small improvements that don't change behavior:
|
|
21
|
-
|
|
22
|
-
- Typo corrections
|
|
23
|
-
- Grammar improvements
|
|
24
|
-
- Clarifying ambiguous language
|
|
25
|
-
- Adding examples
|
|
26
|
-
- Fixing broken links
|
|
27
|
-
|
|
28
|
-
**Process:** Open a pull request directly.
|
|
29
|
-
|
|
30
|
-
### Minor Changes
|
|
31
|
-
|
|
32
|
-
Backward-compatible additions or clarifications that may affect implementations:
|
|
33
|
-
|
|
34
|
-
- Adding test cases
|
|
35
|
-
- Clarifying edge case behavior
|
|
36
|
-
- Adding informative appendices
|
|
37
|
-
- Expanding examples
|
|
38
|
-
|
|
39
|
-
**Process:** Open an issue first to discuss, then submit a pull request.
|
|
40
|
-
|
|
41
|
-
### Contributing Test Fixtures
|
|
42
|
-
|
|
43
|
-
Test fixtures are language-agnostic JSON files that validate TOON implementations. Contributing test cases helps ensure spec compliance across all implementations.
|
|
44
|
-
|
|
45
|
-
**Types of test contributions:**
|
|
46
|
-
|
|
47
|
-
1. **New test cases** - Add tests for uncovered scenarios
|
|
48
|
-
2. **Edge case coverage** - Add tests for corner cases
|
|
49
|
-
3. **Error validation** - Add tests for error conditions
|
|
50
|
-
4. **Spec clarifications** - Add tests when spec behavior is clarified
|
|
51
|
-
|
|
52
|
-
**Test fixture structure:**
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
{
|
|
56
|
-
"version": "1.3",
|
|
57
|
-
"category": "encode",
|
|
58
|
-
"description": "Brief description of test category",
|
|
59
|
-
"tests": [
|
|
60
|
-
{
|
|
61
|
-
"name": "descriptive test name",
|
|
62
|
-
"input": "JSON value or TOON string",
|
|
63
|
-
"expected": "TOON string or JSON value",
|
|
64
|
-
"options": {},
|
|
65
|
-
"specSection": "7.2"
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
20
|
```
|
|
21
|
+
Adding new delimiter types (beyond comma/tab/pipe)
|
|
22
|
+
Example: Supporting semicolon as delimiter
|
|
70
23
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- Use descriptive names that explain what's being validated
|
|
75
|
-
- Link to spec sections using `specSection` field
|
|
76
|
-
- Include edge cases and boundary conditions
|
|
77
|
-
- Add error tests in separate files (e.g., `validation-errors.json`)
|
|
78
|
-
- Follow existing test organization patterns
|
|
79
|
-
- Validate your JSON against `tests/fixtures.schema.json`
|
|
80
|
-
|
|
81
|
-
**Process:**
|
|
82
|
-
|
|
83
|
-
1. Identify the appropriate fixture file in `tests/fixtures/encode/` or `tests/fixtures/decode/`.
|
|
84
|
-
2. Add your test case following the structure above.
|
|
85
|
-
3. Run validation to ensure your fixture is well-formed.
|
|
86
|
-
4. Submit a PR with clear description of what the test validates.
|
|
87
|
-
|
|
88
|
-
See [tests/README.md](./tests/README.md) for complete fixture documentation.
|
|
89
|
-
|
|
90
|
-
### Major Changes
|
|
91
|
-
|
|
92
|
-
Changes that affect compatibility or core behavior:
|
|
93
|
-
- New syntax features
|
|
94
|
-
- Changes to encoding/decoding rules
|
|
95
|
-
- Modifications to conformance requirements
|
|
96
|
-
- Breaking changes
|
|
97
|
-
|
|
98
|
-
**Process:** Follow the RFC process (see below).
|
|
99
|
-
|
|
100
|
-
## Before You Contribute
|
|
101
|
-
|
|
102
|
-
Quick checklist before opening an issue or PR:
|
|
103
|
-
|
|
104
|
-
1. **Check existing issues and PRs** – someone may have already proposed your idea
|
|
105
|
-
2. **Review the specification** ([SPEC.md](./SPEC.md)) to understand current behavior
|
|
106
|
-
3. **Check the reference implementation** to see how it handles the case
|
|
107
|
-
4. **Consider backward compatibility** – breaking changes require strong justification
|
|
108
|
-
|
|
109
|
-
## Proposing Changes
|
|
110
|
-
|
|
111
|
-
### Opening an Issue
|
|
112
|
-
|
|
113
|
-
When opening an issue, please include:
|
|
114
|
-
|
|
115
|
-
1. **Clear description** of the problem or proposed change.
|
|
116
|
-
2. **Current behavior** (with spec references if applicable).
|
|
117
|
-
3. **Proposed behavior** (what should change and why).
|
|
118
|
-
4. **Examples** demonstrating the issue or improvement.
|
|
119
|
-
5. **Impact assessment** on existing implementations.
|
|
120
|
-
6. **Alternatives considered** (if applicable).
|
|
24
|
+
Changing quoting or escape rules
|
|
25
|
+
Example: Adding \u0000 escape sequences
|
|
26
|
+
Example: Changing when colons require quotes
|
|
121
27
|
|
|
122
|
-
|
|
28
|
+
Modifying tabular detection logic
|
|
29
|
+
Example: Allowing non-uniform objects in tabular format
|
|
123
30
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
3. **Update examples** if your change affects them.
|
|
127
|
-
4. **Update CHANGELOG.md** with your changes.
|
|
128
|
-
5. **Write a clear PR description** explaining:
|
|
129
|
-
- What changed and why.
|
|
130
|
-
- How it affects implementations.
|
|
131
|
-
- Whether it's backward-compatible.
|
|
132
|
-
6. **Link related issues** in your PR description.
|
|
31
|
+
New data type normalization rules
|
|
32
|
+
Example: Handling Map or Set differently
|
|
133
33
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- There may be discussion and requests for changes.
|
|
138
|
-
- Once approved, maintainers will merge and assign a version number.
|
|
139
|
-
- For breaking changes, the PR will be held until the next major version.
|
|
140
|
-
|
|
141
|
-
## RFC Process for Major Changes
|
|
142
|
-
|
|
143
|
-
Major changes require a Request for Comments (RFC) process. This ensures community input and helps us avoid breaking changes that haven't been thoroughly considered.
|
|
144
|
-
|
|
145
|
-
### 1. Create an RFC Issue
|
|
146
|
-
|
|
147
|
-
Open an issue with the `[RFC]` prefix and include:
|
|
148
|
-
|
|
149
|
-
```markdown
|
|
150
|
-
# [RFC] Title of Your Proposal
|
|
151
|
-
|
|
152
|
-
## Summary
|
|
153
|
-
Brief overview of the change
|
|
154
|
-
|
|
155
|
-
## Motivation
|
|
156
|
-
Why is this change needed? What problems does it solve?
|
|
157
|
-
|
|
158
|
-
## Detailed Design
|
|
159
|
-
Technical specification of the proposed change
|
|
160
|
-
|
|
161
|
-
## Examples
|
|
162
|
-
Code examples showing the change in action
|
|
163
|
-
|
|
164
|
-
## Drawbacks
|
|
165
|
-
What are the costs and downsides?
|
|
166
|
-
|
|
167
|
-
## Alternatives
|
|
168
|
-
What other designs were considered?
|
|
169
|
-
|
|
170
|
-
## Impact on Implementations
|
|
171
|
-
How will this affect existing implementations?
|
|
34
|
+
Changing array header syntax
|
|
35
|
+
Example: Optional length markers becoming required
|
|
36
|
+
```
|
|
172
37
|
|
|
173
|
-
|
|
174
|
-
How should implementations adopt this change?
|
|
38
|
+
### No – Direct PR or Issue First
|
|
175
39
|
|
|
176
|
-
|
|
177
|
-
|
|
40
|
+
```
|
|
41
|
+
Typo: "recieves" → "receives" → Direct PR
|
|
42
|
+
Adding example for nested arrays → Direct PR
|
|
43
|
+
Clarifying ambiguous wording → Issue → PR
|
|
44
|
+
Expanding test coverage → Direct PR
|
|
45
|
+
Documenting existing edge case behavior → Issue → PR
|
|
178
46
|
```
|
|
179
47
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
- Community members and implementers provide feedback.
|
|
183
|
-
- The RFC is iterated based on feedback.
|
|
184
|
-
- Discussion typically lasts 1-2 weeks minimum.
|
|
48
|
+
## RFC Process
|
|
185
49
|
|
|
186
|
-
|
|
50
|
+
For major changes requiring RFC:
|
|
187
51
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
52
|
+
1. **Create RFC Issue** using the Feature Request/RFC template
|
|
53
|
+
2. **Discussion Period** (minimum 1-2 weeks for community feedback)
|
|
54
|
+
3. **Decision** (maintainers accept, reject, or request revisions)
|
|
55
|
+
4. **Implementation** (create PR referencing RFC issue)
|
|
191
56
|
|
|
192
|
-
|
|
57
|
+
## Contributing Test Fixtures
|
|
193
58
|
|
|
194
|
-
|
|
195
|
-
- PR must reference the RFC issue.
|
|
196
|
-
- Additional review occurs during PR phase.
|
|
59
|
+
Test fixtures validate TOON implementations across languages. Add your test to `tests/fixtures/encode/` or `tests/fixtures/decode/`, validate against `tests/fixtures.schema.json`, and submit a PR.
|
|
197
60
|
|
|
198
|
-
|
|
61
|
+
See [tests/README.md](./tests/README.md) for fixture structure and guidelines.
|
|
199
62
|
|
|
200
|
-
|
|
63
|
+
## Pull Request Guidelines
|
|
201
64
|
|
|
202
|
-
|
|
203
|
-
|
|
65
|
+
1. Fork the repository and create a feature branch
|
|
66
|
+
2. Make changes following [SPEC.md](./SPEC.md) style (RFC 2119 keywords, examples, precision)
|
|
67
|
+
3. Update `CHANGELOG.md` with your changes
|
|
68
|
+
4. Submit PR using the template and link related issues
|
|
204
69
|
|
|
205
|
-
|
|
206
|
-
|
|
70
|
+
**Review process:**
|
|
71
|
+
- Maintainers review and may request changes
|
|
72
|
+
- Breaking changes held until next major version
|
|
73
|
+
- Approved changes merged with version number assigned
|
|
207
74
|
|
|
208
|
-
|
|
209
|
-
While optimized for machines, TOON should remain reasonably readable by humans for debugging and validation.
|
|
75
|
+
## Specification Principles
|
|
210
76
|
|
|
211
|
-
|
|
212
|
-
Prefer simple, consistent rules over special cases. The spec should be implementable without extensive parsing libraries.
|
|
77
|
+
TOON prioritizes (in order):
|
|
213
78
|
|
|
214
|
-
|
|
215
|
-
|
|
79
|
+
1. **Token Efficiency** – Changes should maintain or improve token usage for LLM input
|
|
80
|
+
2. **LLM-Friendly Structure** – Easy for LLMs to parse and generate (explicit markers are features)
|
|
81
|
+
3. **Simplicity** – Prefer consistent rules over special cases
|
|
82
|
+
4. **Backward Compatibility** – Breaking changes need strong justification
|
|
83
|
+
5. **Interoperability** – Implementations must produce identical output for identical input
|
|
84
|
+
6. **Human Readability** – Debuggable by humans despite machine optimization
|
|
216
85
|
|
|
217
|
-
|
|
218
|
-
Multiple implementations should produce identical output for the same input. Ambiguity is not acceptable.
|
|
86
|
+
These principles guide every decision. When in doubt, optimize for token efficiency first.
|
|
219
87
|
|
|
220
88
|
## Style Guidelines
|
|
221
89
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
- Use RFC 2119 keywords (MUST, SHOULD, MAY) correctly
|
|
225
|
-
- Be precise and unambiguous
|
|
226
|
-
- Use examples to clarify complex rules
|
|
227
|
-
- Keep language concise but complete
|
|
228
|
-
- Use active voice where possible
|
|
90
|
+
Follow [SPEC.md](./SPEC.md) conventions:
|
|
229
91
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
-
|
|
233
|
-
-
|
|
234
|
-
-
|
|
235
|
-
- Add cross-references to related sections
|
|
236
|
-
- Keep line length reasonable (80-120 characters)
|
|
237
|
-
|
|
238
|
-
### Examples
|
|
239
|
-
|
|
240
|
-
- Show both input and output
|
|
241
|
-
- Include edge cases
|
|
242
|
-
- Demonstrate both valid and invalid cases
|
|
243
|
-
- Add comments explaining non-obvious behavior
|
|
92
|
+
- **RFC 2119 keywords**: Use MUST/SHOULD/MAY correctly (see SPEC.md §1)
|
|
93
|
+
- **Examples over prose**: Show concrete input/output for complex rules
|
|
94
|
+
- **Precision**: Zero ambiguity – multiple implementations must agree
|
|
95
|
+
- **Structure**: Number sections, cross-reference related rules
|
|
96
|
+
- **Line length**: 80-120 characters for readability
|
|
244
97
|
|
|
245
98
|
## Questions?
|
|
246
99
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
2. Open a new issue with the `question` label.
|
|
251
|
-
3. Reach out to maintainers.
|
|
252
|
-
|
|
253
|
-
## Code of Conduct
|
|
254
|
-
|
|
255
|
-
Be respectful and constructive in all interactions. We're building this specification together, and diverse perspectives make it better.
|
|
100
|
+
1. Check existing issues and discussions
|
|
101
|
+
2. Open an issue with the `question` label
|
|
102
|
+
3. Reach out to maintainers
|
|
256
103
|
|
|
257
104
|
## License
|
|
258
105
|
|
|
259
|
-
By contributing
|
|
106
|
+
By contributing, you agree your contributions will be licensed under the MIT License. Be respectful and constructive – diverse perspectives make TOON better.
|
package/SPEC.md
CHANGED
|
@@ -20,7 +20,7 @@ Token-Oriented Object Notation (TOON) is a compact, human-readable serialization
|
|
|
20
20
|
|
|
21
21
|
## Status of This Document
|
|
22
22
|
|
|
23
|
-
This document is a Working Draft v1.3 and may be updated, replaced, or obsoleted. Implementers should monitor the canonical repository at https://github.com/toon-format/
|
|
23
|
+
This document is a Working Draft v1.3 and may be updated, replaced, or obsoleted. Implementers should monitor the canonical repository at https://github.com/toon-format/spec for changes.
|
|
24
24
|
|
|
25
25
|
This specification is stable for implementation but not yet finalized. Breaking changes are unlikely but possible before v2.0.
|
|
26
26
|
|
|
@@ -335,6 +335,8 @@ Object keys and tabular field names:
|
|
|
335
335
|
- MAY be unquoted only if they match: ^[A-Za-z_][\w.]*$.
|
|
336
336
|
- Otherwise, they MUST be quoted and escaped per Section 7.1.
|
|
337
337
|
|
|
338
|
+
Keys requiring quoting per the above rules MUST be quoted in all contexts, including array headers (e.g., "my-key"[N]:).
|
|
339
|
+
|
|
338
340
|
### 7.4 Decoding Rules for Strings and Keys (Decoding)
|
|
339
341
|
|
|
340
342
|
- Quoted strings and keys MUST be unescaped per Section 7.1; any other escape MUST error. Quoted primitives remain strings.
|
|
@@ -767,7 +769,7 @@ Intended usage: COMMON (upon standardization)
|
|
|
767
769
|
|
|
768
770
|
Restrictions on usage: None
|
|
769
771
|
|
|
770
|
-
Change controller: Community-maintained. See repository at https://github.com/toon-format/
|
|
772
|
+
Change controller: Community-maintained. See repository at https://github.com/toon-format/spec
|
|
771
773
|
|
|
772
774
|
### 18.3 Implementation Status
|
|
773
775
|
|
|
@@ -899,6 +901,19 @@ bignum: 9007199254740992
|
|
|
899
901
|
decimal: 0.3333333333333333
|
|
900
902
|
```
|
|
901
903
|
|
|
904
|
+
Quoted keys with arrays (keys requiring quoting per Section 7.3):
|
|
905
|
+
```
|
|
906
|
+
"my-key"[3]: 1,2,3
|
|
907
|
+
|
|
908
|
+
"x-items"[2]{id,name}:
|
|
909
|
+
1,Ada
|
|
910
|
+
2,Bob
|
|
911
|
+
|
|
912
|
+
"x-items"[2]:
|
|
913
|
+
- id: 1
|
|
914
|
+
- id: 2
|
|
915
|
+
```
|
|
916
|
+
|
|
902
917
|
## Appendix B: Parsing Helpers (Informative)
|
|
903
918
|
|
|
904
919
|
These sketches illustrate structure and common decoding helpers. They are informative; normative behavior is defined in Sections 4–12 and 14.
|
|
@@ -962,8 +977,8 @@ These sketches illustrate structure and common decoding helpers. They are inform
|
|
|
962
977
|
|
|
963
978
|
### Reference Test Suite
|
|
964
979
|
|
|
965
|
-
A reference test suite is maintained at:
|
|
966
|
-
https://github.com/toon-format/
|
|
980
|
+
A language-agnostic reference test suite is maintained at:
|
|
981
|
+
https://github.com/toon-format/spec/tree/main/tests
|
|
967
982
|
|
|
968
983
|
The test suite is versioned alongside this specification. Implementations are encouraged to validate against this test suite, but conformance is determined solely by adherence to the normative requirements in Sections 1-16 and Section 19 of this specification. Test coverage does not define the specification; the specification defines conformance.
|
|
969
984
|
|
|
@@ -984,11 +999,15 @@ The reference test suite covers:
|
|
|
984
999
|
|
|
985
1000
|
## Appendix D: Document Changelog (Informative)
|
|
986
1001
|
|
|
1002
|
+
### v1.4 (2025-11-02)
|
|
1003
|
+
|
|
1004
|
+
- Clarified that keys requiring quoting (Section 7.3) MUST be quoted in all contexts, including array headers (e.g., "my-key"[N]:, "x-custom"[2]{fields}:).
|
|
1005
|
+
- No semantic changes to the specification; this is purely clarifying documentation that was already implied by the grammar.
|
|
1006
|
+
|
|
987
1007
|
### v1.3 (2025-10-31)
|
|
988
1008
|
|
|
989
1009
|
- Added numeric precision requirements: JavaScript implementations SHOULD use Number.toString() precision (15-17 digits), all implementations MUST preserve round-trip fidelity (Section 2).
|
|
990
1010
|
- Added RFC 5234 core rules (ALPHA, DIGIT, DQUOTE, HTAB, LF, SP) to ABNF grammar definitions (Section 6).
|
|
991
|
-
- Added test case for repeating decimal precision (1/3) to validate round-trip behavior.
|
|
992
1011
|
|
|
993
1012
|
### v1.2 (2025-10-29)
|
|
994
1013
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toon-format/spec",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"packageManager": "pnpm@10.19.0",
|
|
6
6
|
"description": "Official specification for Token-Oriented Object Notation (TOON)",
|
|
7
7
|
"author": "Johann Schopplich <hello@johannschopplich.com>",
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
},
|
|
15
15
|
"specSection": "7"
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
"name": "parses list arrays with empty items",
|
|
19
|
+
"input": "items[3]:\n - first\n - second\n -",
|
|
20
|
+
"expected": {
|
|
21
|
+
"items": ["first", "second", {}]
|
|
22
|
+
},
|
|
23
|
+
"specSection": "7.3"
|
|
24
|
+
},
|
|
17
25
|
{
|
|
18
26
|
"name": "parses objects with nested values inside list items",
|
|
19
27
|
"input": "items[1]:\n - id: 1\n nested:\n x: 1",
|
|
@@ -151,6 +159,17 @@
|
|
|
151
159
|
"items": [{ "a": 1 }, [1, 2]]
|
|
152
160
|
},
|
|
153
161
|
"specSection": "7.3"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "parses quoted key with list array format",
|
|
165
|
+
"input": "\"x-items\"[2]:\n - id: 1\n - id: 2",
|
|
166
|
+
"expected": {
|
|
167
|
+
"x-items": [
|
|
168
|
+
{ "id": 1 },
|
|
169
|
+
{ "id": 2 }
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"specSection": "7"
|
|
154
173
|
}
|
|
155
174
|
]
|
|
156
175
|
}
|
|
@@ -82,6 +82,30 @@
|
|
|
82
82
|
"items": ["[5]", "- item", "{key}"]
|
|
83
83
|
},
|
|
84
84
|
"specSection": "7.1"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "parses quoted key with inline array",
|
|
88
|
+
"input": "\"my-key\"[3]: 1,2,3",
|
|
89
|
+
"expected": {
|
|
90
|
+
"my-key": [1, 2, 3]
|
|
91
|
+
},
|
|
92
|
+
"specSection": "7.1"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "parses quoted key containing brackets with inline array",
|
|
96
|
+
"input": "\"key[test]\"[3]: 1,2,3",
|
|
97
|
+
"expected": {
|
|
98
|
+
"key[test]": [1, 2, 3]
|
|
99
|
+
},
|
|
100
|
+
"specSection": "7.1"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "parses quoted key with empty array",
|
|
104
|
+
"input": "\"x-custom\"[0]:",
|
|
105
|
+
"expected": {
|
|
106
|
+
"x-custom": []
|
|
107
|
+
},
|
|
108
|
+
"specSection": "7.1"
|
|
85
109
|
}
|
|
86
110
|
]
|
|
87
111
|
}
|
|
@@ -35,6 +35,17 @@
|
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
"specSection": "7.2"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "parses quoted key with tabular array format",
|
|
41
|
+
"input": "\"x-items\"[2]{id,name}:\n 1,Ada\n 2,Bob",
|
|
42
|
+
"expected": {
|
|
43
|
+
"x-items": [
|
|
44
|
+
{ "id": 1, "name": "Ada" },
|
|
45
|
+
{ "id": 2, "name": "Bob" }
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"specSection": "7.2"
|
|
38
49
|
}
|
|
39
50
|
]
|
|
40
51
|
}
|
|
@@ -156,6 +156,27 @@
|
|
|
156
156
|
},
|
|
157
157
|
"specSection": "9"
|
|
158
158
|
},
|
|
159
|
+
{
|
|
160
|
+
"name": "accepts list items with irregular nested indentation when strict=false",
|
|
161
|
+
"input": "items[2]:\n - id: 1\n nested:\n value: test\n - id: 2",
|
|
162
|
+
"expected": {
|
|
163
|
+
"items": [
|
|
164
|
+
{
|
|
165
|
+
"id": 1,
|
|
166
|
+
"nested": {
|
|
167
|
+
"value": "test"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"id": 2
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
"options": {
|
|
176
|
+
"strict": false
|
|
177
|
+
},
|
|
178
|
+
"specSection": "4"
|
|
179
|
+
},
|
|
159
180
|
{
|
|
160
181
|
"name": "empty lines do not trigger validation errors",
|
|
161
182
|
"input": "a: 1\n\nb: 2",
|