@toon-format/spec 1.3.2 → 1.4.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.
- package/CHANGELOG.md +14 -0
- package/README.md +3 -2
- package/SPEC.md +252 -100
- package/VERSIONING.md +0 -13
- package/package.json +1 -1
- package/tests/README.md +27 -23
- package/tests/fixtures/decode/arrays-nested.json +40 -21
- package/tests/fixtures/decode/arrays-primitive.json +14 -14
- package/tests/fixtures/decode/arrays-tabular.json +28 -5
- package/tests/fixtures/decode/blank-lines.json +14 -14
- package/tests/fixtures/decode/delimiters.json +46 -29
- package/tests/fixtures/decode/indentation-errors.json +16 -50
- package/tests/fixtures/decode/numbers.json +142 -0
- package/tests/fixtures/decode/objects.json +29 -29
- package/tests/fixtures/decode/primitives.json +44 -75
- package/tests/fixtures/decode/root-form.json +17 -0
- package/tests/fixtures/decode/validation-errors.json +29 -9
- package/tests/fixtures/decode/whitespace.json +61 -0
- package/tests/fixtures/encode/arrays-nested.json +15 -15
- package/tests/fixtures/encode/arrays-objects.json +16 -16
- package/tests/fixtures/encode/arrays-primitive.json +14 -14
- package/tests/fixtures/encode/arrays-tabular.json +8 -8
- package/tests/fixtures/encode/delimiters.json +23 -23
- package/tests/fixtures/encode/objects.json +27 -27
- package/tests/fixtures/encode/options.json +1 -1
- package/tests/fixtures/encode/primitives.json +61 -36
- package/tests/fixtures/encode/whitespace.json +18 -3
- package/tests/fixtures.schema.json +3 -4
- package/tests/fixtures/encode/normalization.json +0 -107
package/tests/README.md
CHANGED
|
@@ -25,16 +25,18 @@ tests/
|
|
|
25
25
|
│ │ ├── arrays-nested.json
|
|
26
26
|
│ │ ├── arrays-objects.json
|
|
27
27
|
│ │ ├── delimiters.json
|
|
28
|
-
│ │ ├── normalization.json
|
|
29
28
|
│ │ ├── whitespace.json
|
|
30
29
|
│ │ └── options.json
|
|
31
30
|
│ └── decode/ # Decoding tests (TOON → JSON)
|
|
32
31
|
│ ├── primitives.json
|
|
32
|
+
│ ├── numbers.json
|
|
33
33
|
│ ├── objects.json
|
|
34
34
|
│ ├── arrays-primitive.json
|
|
35
35
|
│ ├── arrays-tabular.json
|
|
36
36
|
│ ├── arrays-nested.json
|
|
37
37
|
│ ├── delimiters.json
|
|
38
|
+
│ ├── whitespace.json
|
|
39
|
+
│ ├── root-form.json
|
|
38
40
|
│ ├── validation-errors.json
|
|
39
41
|
│ ├── indentation-errors.json
|
|
40
42
|
│ └── blank-lines.json
|
|
@@ -47,7 +49,7 @@ All test fixtures follow a standard JSON structure defined in [`fixtures.schema.
|
|
|
47
49
|
|
|
48
50
|
```json
|
|
49
51
|
{
|
|
50
|
-
"version": "1.
|
|
52
|
+
"version": "1.4",
|
|
51
53
|
"category": "encode",
|
|
52
54
|
"description": "Brief description of test category",
|
|
53
55
|
"tests": [
|
|
@@ -88,13 +90,13 @@ All test fixtures follow a standard JSON structure defined in [`fixtures.schema.
|
|
|
88
90
|
{
|
|
89
91
|
"delimiter": ",",
|
|
90
92
|
"indent": 2,
|
|
91
|
-
"lengthMarker": ""
|
|
93
|
+
"lengthMarker": "#"
|
|
92
94
|
}
|
|
93
95
|
```
|
|
94
96
|
|
|
95
|
-
- `delimiter`: `","` (comma, default), `"\t"` (tab), or `"|"` (pipe)
|
|
97
|
+
- `delimiter`: `","` (comma, default), `"\t"` (tab), or `"|"` (pipe). Affects encoder output for multiline object values; decoders parse what's present
|
|
96
98
|
- `indent`: Number of spaces per indentation level (default: `2`)
|
|
97
|
-
- `lengthMarker`: `"#"` to prefix array lengths
|
|
99
|
+
- `lengthMarker`: Optional. Set to `"#"` to prefix array lengths (e.g., `[#3]`). Omit this property to disable length markers
|
|
98
100
|
|
|
99
101
|
#### Decoding Options
|
|
100
102
|
|
|
@@ -143,30 +145,32 @@ The fixture format is language-agnostic JSON, so you can load and iterate it usi
|
|
|
143
145
|
|
|
144
146
|
| File | Description | Spec Sections |
|
|
145
147
|
|------|-------------|---------------|
|
|
146
|
-
| `primitives.json` | String, number, boolean, null encoding and escaping | §
|
|
147
|
-
| `objects.json` | Simple objects, nested objects, key encoding | §
|
|
148
|
-
| `arrays-primitive.json` | Inline primitive arrays, empty arrays | §
|
|
149
|
-
| `arrays-tabular.json` | Tabular format with header and rows | §
|
|
150
|
-
| `arrays-nested.json` | Arrays of arrays, mixed arrays | §
|
|
151
|
-
| `arrays-objects.json` | Objects as list items, complex nesting | §
|
|
152
|
-
| `delimiters.json` | Tab and pipe delimiter options | §
|
|
153
|
-
| `
|
|
154
|
-
| `whitespace.json` | Formatting invariants and indentation | §4 |
|
|
148
|
+
| `primitives.json` | String, number, boolean, null encoding and escaping | §7.1/§7.2, §2 |
|
|
149
|
+
| `objects.json` | Simple objects, nested objects, key encoding | §8 (keys: §7.3/§7.1) |
|
|
150
|
+
| `arrays-primitive.json` | Inline primitive arrays, empty arrays | §9.1 |
|
|
151
|
+
| `arrays-tabular.json` | Tabular format with header and rows | §9.3 |
|
|
152
|
+
| `arrays-nested.json` | Arrays of arrays, mixed arrays | §9.2/§9.4 |
|
|
153
|
+
| `arrays-objects.json` | Objects as list items, complex nesting | §9, §10 |
|
|
154
|
+
| `delimiters.json` | Tab and pipe delimiter options | §11 |
|
|
155
|
+
| `whitespace.json` | Formatting invariants and indentation | §12 |
|
|
155
156
|
| `options.json` | Length marker and delimiter option combinations | §3 |
|
|
156
157
|
|
|
157
158
|
### Decoding Tests (`fixtures/decode/`)
|
|
158
159
|
|
|
159
160
|
| File | Description | Spec Sections |
|
|
160
161
|
|------|-------------|---------------|
|
|
161
|
-
| `primitives.json` | Parsing primitives, unescaping, ambiguity | §
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `arrays-
|
|
165
|
-
| `arrays-
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
162
|
+
| `primitives.json` | Parsing primitives, unescaping, ambiguity | §4, §7.1/§7.4 |
|
|
163
|
+
| `numbers.json` | Number edge cases, exponent forms, leading zeros | §4 |
|
|
164
|
+
| `objects.json` | Parsing objects, keys, nesting | §8 (keys: §7.3/§7.1) |
|
|
165
|
+
| `arrays-primitive.json` | Inline array parsing | §9.1 |
|
|
166
|
+
| `arrays-tabular.json` | Tabular format parsing | §9.3 |
|
|
167
|
+
| `arrays-nested.json` | Nested and mixed array parsing | §9.2/§9.4 |
|
|
168
|
+
| `delimiters.json` | Delimiter detection and parsing | §11 |
|
|
169
|
+
| `whitespace.json` | Whitespace tolerance and token trimming | §12 |
|
|
170
|
+
| `root-form.json` | Root form detection (empty, single primitive) | §5 |
|
|
171
|
+
| `validation-errors.json` | Syntax errors, length mismatches, malformed input | §14 |
|
|
172
|
+
| `indentation-errors.json` | Strict mode indentation validation | §14.3, §12 |
|
|
173
|
+
| `blank-lines.json` | Blank line handling in arrays | §14.4, §12 |
|
|
170
174
|
|
|
171
175
|
## Validating Fixtures
|
|
172
176
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "decode",
|
|
4
4
|
"description": "Nested and mixed array decoding - list format, arrays of arrays, root arrays, mixed types",
|
|
5
5
|
"tests": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{ "id": 2, "name": "Second", "extra": true }
|
|
13
13
|
]
|
|
14
14
|
},
|
|
15
|
-
"specSection": "
|
|
15
|
+
"specSection": "9.4"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "parses list arrays with empty items",
|
|
@@ -20,17 +20,36 @@
|
|
|
20
20
|
"expected": {
|
|
21
21
|
"items": ["first", "second", {}]
|
|
22
22
|
},
|
|
23
|
-
"specSection": "
|
|
23
|
+
"specSection": "9.4"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
"name": "parses
|
|
26
|
+
"name": "parses list arrays with deeply nested objects",
|
|
27
|
+
"input": "items[2]:\n - properties:\n state:\n type: string\n - id: 2",
|
|
28
|
+
"expected": {
|
|
29
|
+
"items": [
|
|
30
|
+
{
|
|
31
|
+
"properties": {
|
|
32
|
+
"state": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": 2
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"specSection": "10"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "parses list arrays containing objects with nested properties",
|
|
27
46
|
"input": "items[1]:\n - id: 1\n nested:\n x: 1",
|
|
28
47
|
"expected": {
|
|
29
48
|
"items": [
|
|
30
49
|
{ "id": 1, "nested": { "x": 1 } }
|
|
31
50
|
]
|
|
32
51
|
},
|
|
33
|
-
"specSection": "
|
|
52
|
+
"specSection": "9.4"
|
|
34
53
|
},
|
|
35
54
|
{
|
|
36
55
|
"name": "parses nested tabular arrays as first field on hyphen line",
|
|
@@ -46,7 +65,7 @@
|
|
|
46
65
|
}
|
|
47
66
|
]
|
|
48
67
|
},
|
|
49
|
-
"specSection": "
|
|
68
|
+
"specSection": "10"
|
|
50
69
|
},
|
|
51
70
|
{
|
|
52
71
|
"name": "parses objects containing arrays (including empty arrays) in list format",
|
|
@@ -56,7 +75,7 @@
|
|
|
56
75
|
{ "name": "test", "data": [] }
|
|
57
76
|
]
|
|
58
77
|
},
|
|
59
|
-
"specSection": "
|
|
78
|
+
"specSection": "9.4"
|
|
60
79
|
},
|
|
61
80
|
{
|
|
62
81
|
"name": "parses arrays of arrays within objects",
|
|
@@ -66,7 +85,7 @@
|
|
|
66
85
|
{ "matrix": [[1, 2], [3, 4]], "name": "grid" }
|
|
67
86
|
]
|
|
68
87
|
},
|
|
69
|
-
"specSection": "
|
|
88
|
+
"specSection": "9.2"
|
|
70
89
|
},
|
|
71
90
|
{
|
|
72
91
|
"name": "parses nested arrays of primitives",
|
|
@@ -74,7 +93,7 @@
|
|
|
74
93
|
"expected": {
|
|
75
94
|
"pairs": [["a", "b"], ["c", "d"]]
|
|
76
95
|
},
|
|
77
|
-
"specSection": "
|
|
96
|
+
"specSection": "9.2"
|
|
78
97
|
},
|
|
79
98
|
{
|
|
80
99
|
"name": "parses quoted strings and mixed lengths in nested arrays",
|
|
@@ -82,7 +101,7 @@
|
|
|
82
101
|
"expected": {
|
|
83
102
|
"pairs": [["a", "b"], ["c,d", "e:f", "true"]]
|
|
84
103
|
},
|
|
85
|
-
"specSection": "
|
|
104
|
+
"specSection": "9.2"
|
|
86
105
|
},
|
|
87
106
|
{
|
|
88
107
|
"name": "parses empty inner arrays",
|
|
@@ -90,7 +109,7 @@
|
|
|
90
109
|
"expected": {
|
|
91
110
|
"pairs": [[], []]
|
|
92
111
|
},
|
|
93
|
-
"specSection": "
|
|
112
|
+
"specSection": "9.2"
|
|
94
113
|
},
|
|
95
114
|
{
|
|
96
115
|
"name": "parses mixed-length inner arrays",
|
|
@@ -98,37 +117,37 @@
|
|
|
98
117
|
"expected": {
|
|
99
118
|
"pairs": [[1], [2, 3]]
|
|
100
119
|
},
|
|
101
|
-
"specSection": "
|
|
120
|
+
"specSection": "9.2"
|
|
102
121
|
},
|
|
103
122
|
{
|
|
104
123
|
"name": "parses root arrays of primitives (inline)",
|
|
105
124
|
"input": "[5]: x,y,\"true\",true,10",
|
|
106
125
|
"expected": ["x", "y", "true", true, 10],
|
|
107
|
-
"specSection": "
|
|
126
|
+
"specSection": "9.1"
|
|
108
127
|
},
|
|
109
128
|
{
|
|
110
129
|
"name": "parses root arrays of uniform objects in tabular format",
|
|
111
130
|
"input": "[2]{id}:\n 1\n 2",
|
|
112
131
|
"expected": [{ "id": 1 }, { "id": 2 }],
|
|
113
|
-
"specSection": "
|
|
132
|
+
"specSection": "9.3"
|
|
114
133
|
},
|
|
115
134
|
{
|
|
116
135
|
"name": "parses root arrays of non-uniform objects in list format",
|
|
117
136
|
"input": "[2]:\n - id: 1\n - id: 2\n name: Ada",
|
|
118
137
|
"expected": [{ "id": 1 }, { "id": 2, "name": "Ada" }],
|
|
119
|
-
"specSection": "
|
|
138
|
+
"specSection": "9.4"
|
|
120
139
|
},
|
|
121
140
|
{
|
|
122
141
|
"name": "parses empty root arrays",
|
|
123
142
|
"input": "[0]:",
|
|
124
143
|
"expected": [],
|
|
125
|
-
"specSection": "
|
|
144
|
+
"specSection": "9.1"
|
|
126
145
|
},
|
|
127
146
|
{
|
|
128
147
|
"name": "parses root arrays of arrays",
|
|
129
148
|
"input": "[2]:\n - [2]: 1,2\n - [0]:",
|
|
130
149
|
"expected": [[1, 2], []],
|
|
131
|
-
"specSection": "
|
|
150
|
+
"specSection": "9.2"
|
|
132
151
|
},
|
|
133
152
|
{
|
|
134
153
|
"name": "parses complex mixed object with arrays and nested objects",
|
|
@@ -142,7 +161,7 @@
|
|
|
142
161
|
"prefs": []
|
|
143
162
|
}
|
|
144
163
|
},
|
|
145
|
-
"specSection": "
|
|
164
|
+
"specSection": "8"
|
|
146
165
|
},
|
|
147
166
|
{
|
|
148
167
|
"name": "parses arrays mixing primitives, objects and strings (list format)",
|
|
@@ -150,7 +169,7 @@
|
|
|
150
169
|
"expected": {
|
|
151
170
|
"items": [1, { "a": 1 }, "text"]
|
|
152
171
|
},
|
|
153
|
-
"specSection": "
|
|
172
|
+
"specSection": "9.4"
|
|
154
173
|
},
|
|
155
174
|
{
|
|
156
175
|
"name": "parses arrays mixing objects and arrays",
|
|
@@ -158,7 +177,7 @@
|
|
|
158
177
|
"expected": {
|
|
159
178
|
"items": [{ "a": 1 }, [1, 2]]
|
|
160
179
|
},
|
|
161
|
-
"specSection": "
|
|
180
|
+
"specSection": "9.4"
|
|
162
181
|
},
|
|
163
182
|
{
|
|
164
183
|
"name": "parses quoted key with list array format",
|
|
@@ -169,7 +188,7 @@
|
|
|
169
188
|
{ "id": 2 }
|
|
170
189
|
]
|
|
171
190
|
},
|
|
172
|
-
"specSection": "
|
|
191
|
+
"specSection": "9.4"
|
|
173
192
|
}
|
|
174
193
|
]
|
|
175
194
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "decode",
|
|
4
4
|
"description": "Primitive array decoding - inline arrays of strings, numbers, booleans, quoted strings",
|
|
5
5
|
"tests": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"expected": {
|
|
10
10
|
"tags": ["reading", "gaming", "coding"]
|
|
11
11
|
},
|
|
12
|
-
"specSection": "
|
|
12
|
+
"specSection": "9.1"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "parses number arrays inline",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"expected": {
|
|
18
18
|
"nums": [1, 2, 3]
|
|
19
19
|
},
|
|
20
|
-
"specSection": "
|
|
20
|
+
"specSection": "9.1"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"name": "parses mixed primitive arrays inline",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"expected": {
|
|
26
26
|
"data": ["x", "y", true, 10]
|
|
27
27
|
},
|
|
28
|
-
"specSection": "
|
|
28
|
+
"specSection": "9.1"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "parses empty arrays",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"expected": {
|
|
34
34
|
"items": []
|
|
35
35
|
},
|
|
36
|
-
"specSection": "
|
|
36
|
+
"specSection": "9.1"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "parses single-item array with empty string",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"expected": {
|
|
42
42
|
"items": [""]
|
|
43
43
|
},
|
|
44
|
-
"specSection": "
|
|
44
|
+
"specSection": "9.1"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"name": "parses multi-item array with empty string",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"expected": {
|
|
50
50
|
"items": ["a", "", "b"]
|
|
51
51
|
},
|
|
52
|
-
"specSection": "
|
|
52
|
+
"specSection": "9.1"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"name": "parses whitespace-only strings in arrays",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"expected": {
|
|
58
58
|
"items": [" ", " "]
|
|
59
59
|
},
|
|
60
|
-
"specSection": "
|
|
60
|
+
"specSection": "9.1"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"name": "parses strings with delimiters in arrays",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"expected": {
|
|
66
66
|
"items": ["a", "b,c", "d:e"]
|
|
67
67
|
},
|
|
68
|
-
"specSection": "
|
|
68
|
+
"specSection": "9.1"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
"name": "parses strings that look like primitives when quoted",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"expected": {
|
|
74
74
|
"items": ["x", "true", "42", "-3.14"]
|
|
75
75
|
},
|
|
76
|
-
"specSection": "
|
|
76
|
+
"specSection": "9.1"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
"name": "parses strings with structural tokens in arrays",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"expected": {
|
|
82
82
|
"items": ["[5]", "- item", "{key}"]
|
|
83
83
|
},
|
|
84
|
-
"specSection": "
|
|
84
|
+
"specSection": "9.1"
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"name": "parses quoted key with inline array",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"expected": {
|
|
90
90
|
"my-key": [1, 2, 3]
|
|
91
91
|
},
|
|
92
|
-
"specSection": "
|
|
92
|
+
"specSection": "9.1"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"name": "parses quoted key containing brackets with inline array",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"expected": {
|
|
98
98
|
"key[test]": [1, 2, 3]
|
|
99
99
|
},
|
|
100
|
-
"specSection": "
|
|
100
|
+
"specSection": "9.1"
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"name": "parses quoted key with empty array",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"expected": {
|
|
106
106
|
"x-custom": []
|
|
107
107
|
},
|
|
108
|
-
"specSection": "
|
|
108
|
+
"specSection": "9.1"
|
|
109
109
|
}
|
|
110
110
|
]
|
|
111
111
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "decode",
|
|
4
4
|
"description": "Tabular array decoding - parsing arrays of uniform objects with headers",
|
|
5
5
|
"tests": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{ "sku": "B2", "qty": 1, "price": 14.5 }
|
|
13
13
|
]
|
|
14
14
|
},
|
|
15
|
-
"specSection": "
|
|
15
|
+
"specSection": "9.3"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "parses nulls and quoted values in tabular rows",
|
|
@@ -23,7 +23,18 @@
|
|
|
23
23
|
{ "id": 2, "value": "test" }
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
|
-
"specSection": "
|
|
26
|
+
"specSection": "9.3"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "parses quoted colon in tabular row as data",
|
|
30
|
+
"input": "items[2]{id,note}:\n 1,\"a:b\"\n 2,\"c:d\"",
|
|
31
|
+
"expected": {
|
|
32
|
+
"items": [
|
|
33
|
+
{ "id": 1, "note": "a:b" },
|
|
34
|
+
{ "id": 2, "note": "c:d" }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"specSection": "9.3"
|
|
27
38
|
},
|
|
28
39
|
{
|
|
29
40
|
"name": "parses quoted header keys in tabular arrays",
|
|
@@ -34,7 +45,7 @@
|
|
|
34
45
|
{ "order:id": 2, "full name": "Bob" }
|
|
35
46
|
]
|
|
36
47
|
},
|
|
37
|
-
"specSection": "
|
|
48
|
+
"specSection": "9.3"
|
|
38
49
|
},
|
|
39
50
|
{
|
|
40
51
|
"name": "parses quoted key with tabular array format",
|
|
@@ -45,7 +56,19 @@
|
|
|
45
56
|
{ "id": 2, "name": "Bob" }
|
|
46
57
|
]
|
|
47
58
|
},
|
|
48
|
-
"specSection": "
|
|
59
|
+
"specSection": "9.3"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "unquoted colon terminates tabular rows and starts key-value pair",
|
|
63
|
+
"input": "items[2]{id,name}:\n 1,Alice\n 2,Bob\ncount: 2",
|
|
64
|
+
"expected": {
|
|
65
|
+
"items": [
|
|
66
|
+
{ "id": 1, "name": "Alice" },
|
|
67
|
+
{ "id": 2, "name": "Bob" }
|
|
68
|
+
],
|
|
69
|
+
"count": 2
|
|
70
|
+
},
|
|
71
|
+
"specSection": "9.3"
|
|
49
72
|
}
|
|
50
73
|
]
|
|
51
74
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "decode",
|
|
4
4
|
"description": "Blank line handling - strict mode errors on blank lines inside arrays, accepts blank lines outside arrays",
|
|
5
5
|
"tests": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"options": {
|
|
12
12
|
"strict": true
|
|
13
13
|
},
|
|
14
|
-
"specSection": "
|
|
14
|
+
"specSection": "14.4"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "throws on blank line inside tabular array",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"options": {
|
|
22
22
|
"strict": true
|
|
23
23
|
},
|
|
24
|
-
"specSection": "
|
|
24
|
+
"specSection": "14.4"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "throws on multiple blank lines inside array",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"options": {
|
|
32
32
|
"strict": true
|
|
33
33
|
},
|
|
34
|
-
"specSection": "
|
|
34
|
+
"specSection": "14.4"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"name": "throws on blank line with spaces inside array",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"options": {
|
|
42
42
|
"strict": true
|
|
43
43
|
},
|
|
44
|
-
"specSection": "
|
|
44
|
+
"specSection": "14.4"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"name": "throws on blank line in nested list array",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"options": {
|
|
52
52
|
"strict": true
|
|
53
53
|
},
|
|
54
|
-
"specSection": "
|
|
54
|
+
"specSection": "14.4"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"name": "accepts blank line between root-level fields",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"options": {
|
|
64
64
|
"strict": true
|
|
65
65
|
},
|
|
66
|
-
"specSection": "
|
|
66
|
+
"specSection": "12"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"name": "accepts trailing newline at end of file",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"options": {
|
|
75
75
|
"strict": true
|
|
76
76
|
},
|
|
77
|
-
"specSection": "
|
|
77
|
+
"specSection": "12"
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
"name": "accepts multiple trailing newlines",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"options": {
|
|
86
86
|
"strict": true
|
|
87
87
|
},
|
|
88
|
-
"specSection": "
|
|
88
|
+
"specSection": "12"
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"name": "accepts blank line after array ends",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"options": {
|
|
98
98
|
"strict": true
|
|
99
99
|
},
|
|
100
|
-
"specSection": "
|
|
100
|
+
"specSection": "12"
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"name": "accepts blank line between nested object fields",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"options": {
|
|
112
112
|
"strict": true
|
|
113
113
|
},
|
|
114
|
-
"specSection": "
|
|
114
|
+
"specSection": "12"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"name": "ignores blank lines inside list array when strict=false",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"options": {
|
|
123
123
|
"strict": false
|
|
124
124
|
},
|
|
125
|
-
"specSection": "
|
|
125
|
+
"specSection": "12"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"name": "ignores blank lines inside tabular array when strict=false",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"options": {
|
|
137
137
|
"strict": false
|
|
138
138
|
},
|
|
139
|
-
"specSection": "
|
|
139
|
+
"specSection": "12"
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
"name": "ignores multiple blank lines in arrays when strict=false",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"options": {
|
|
148
148
|
"strict": false
|
|
149
149
|
},
|
|
150
|
-
"specSection": "
|
|
150
|
+
"specSection": "12"
|
|
151
151
|
}
|
|
152
152
|
]
|
|
153
153
|
}
|