@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.
- package/CHANGELOG.md +28 -0
- package/README.md +15 -3
- package/SPEC.md +435 -102
- package/VERSIONING.md +1 -14
- package/package.json +1 -1
- package/tests/README.md +42 -28
- package/tests/fixtures/decode/arrays-nested.json +20 -20
- 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 -29
- package/tests/fixtures/decode/numbers.json +142 -0
- package/tests/fixtures/decode/objects.json +29 -29
- package/tests/fixtures/decode/path-expansion.json +173 -0
- 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/key-folding.json +218 -0
- 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 +20 -4
- package/tests/fixtures/encode/normalization.json +0 -107
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "decode",
|
|
4
4
|
"description": "Validation errors - length mismatches, invalid escapes, syntax errors, delimiter mismatches",
|
|
5
5
|
"tests": [
|
|
@@ -8,56 +8,76 @@
|
|
|
8
8
|
"input": "tags[2]: a,b,c",
|
|
9
9
|
"expected": null,
|
|
10
10
|
"shouldError": true,
|
|
11
|
-
"specSection": "
|
|
11
|
+
"specSection": "14.1"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "throws on array length mismatch (list format - too many)",
|
|
15
15
|
"input": "items[1]:\n - 1\n - 2",
|
|
16
16
|
"expected": null,
|
|
17
17
|
"shouldError": true,
|
|
18
|
-
"specSection": "
|
|
18
|
+
"specSection": "14.1"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "throws when tabular row value count does not match header field count",
|
|
22
22
|
"input": "items[2]{id,name}:\n 1,Ada\n 2",
|
|
23
23
|
"expected": null,
|
|
24
24
|
"shouldError": true,
|
|
25
|
-
"specSection": "
|
|
25
|
+
"specSection": "14.1"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"name": "throws when tabular row count does not match header length",
|
|
29
29
|
"input": "[1]{id}:\n 1\n 2",
|
|
30
30
|
"expected": null,
|
|
31
31
|
"shouldError": true,
|
|
32
|
-
"specSection": "
|
|
32
|
+
"specSection": "14.1"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"name": "throws on invalid escape sequence",
|
|
36
36
|
"input": "\"a\\x\"",
|
|
37
37
|
"expected": null,
|
|
38
38
|
"shouldError": true,
|
|
39
|
-
"specSection": "
|
|
39
|
+
"specSection": "14.2"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "throws on unterminated string",
|
|
43
43
|
"input": "\"unterminated",
|
|
44
44
|
"expected": null,
|
|
45
45
|
"shouldError": true,
|
|
46
|
-
"specSection": "
|
|
46
|
+
"specSection": "14.2"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"name": "throws on missing colon in key-value context",
|
|
50
50
|
"input": "a:\n user",
|
|
51
51
|
"expected": null,
|
|
52
52
|
"shouldError": true,
|
|
53
|
-
"specSection": "
|
|
53
|
+
"specSection": "14.2"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "throws on two primitives at root depth in strict mode",
|
|
57
|
+
"input": "hello\nworld",
|
|
58
|
+
"expected": null,
|
|
59
|
+
"shouldError": true,
|
|
60
|
+
"options": {
|
|
61
|
+
"strict": true
|
|
62
|
+
},
|
|
63
|
+
"specSection": "5"
|
|
54
64
|
},
|
|
55
65
|
{
|
|
56
66
|
"name": "throws on delimiter mismatch (header declares tab, row uses comma)",
|
|
57
67
|
"input": "items[2\t]{a\tb}:\n 1,2\n 3,4",
|
|
58
68
|
"expected": null,
|
|
59
69
|
"shouldError": true,
|
|
60
|
-
"specSection": "
|
|
70
|
+
"specSection": "14.2"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "throws on mismatched delimiter between bracket and brace fields",
|
|
74
|
+
"input": "items[2\t]{a,b}:\n 1\t2\n 3\t4",
|
|
75
|
+
"expected": null,
|
|
76
|
+
"shouldError": true,
|
|
77
|
+
"options": {
|
|
78
|
+
"strict": true
|
|
79
|
+
},
|
|
80
|
+
"specSection": "6"
|
|
61
81
|
}
|
|
62
82
|
]
|
|
63
83
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.4",
|
|
3
|
+
"category": "decode",
|
|
4
|
+
"description": "Whitespace tolerance in decoding - surrounding spaces around delimiters and values",
|
|
5
|
+
"tests": [
|
|
6
|
+
{
|
|
7
|
+
"name": "tolerates spaces around commas in inline arrays",
|
|
8
|
+
"input": "tags[3]: a , b , c",
|
|
9
|
+
"expected": {
|
|
10
|
+
"tags": ["a", "b", "c"]
|
|
11
|
+
},
|
|
12
|
+
"specSection": "12",
|
|
13
|
+
"note": "Surrounding whitespace SHOULD be tolerated; tokens are trimmed"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "tolerates spaces around pipes in inline arrays",
|
|
17
|
+
"input": "tags[3|]: a | b | c",
|
|
18
|
+
"expected": {
|
|
19
|
+
"tags": ["a", "b", "c"]
|
|
20
|
+
},
|
|
21
|
+
"specSection": "12"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "tolerates spaces around tabs in inline arrays",
|
|
25
|
+
"input": "tags[3\t]: a \t b \t c",
|
|
26
|
+
"expected": {
|
|
27
|
+
"tags": ["a", "b", "c"]
|
|
28
|
+
},
|
|
29
|
+
"specSection": "12"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "tolerates leading and trailing spaces in tabular row values",
|
|
33
|
+
"input": "items[2]{id,name}:\n 1 , Alice \n 2 , Bob ",
|
|
34
|
+
"expected": {
|
|
35
|
+
"items": [
|
|
36
|
+
{ "id": 1, "name": "Alice" },
|
|
37
|
+
{ "id": 2, "name": "Bob" }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"specSection": "12",
|
|
41
|
+
"note": "Values in tabular rows are trimmed"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "tolerates spaces around delimiters with quoted values",
|
|
45
|
+
"input": "items[3]: \"a\" , \"b\" , \"c\"",
|
|
46
|
+
"expected": {
|
|
47
|
+
"items": ["a", "b", "c"]
|
|
48
|
+
},
|
|
49
|
+
"specSection": "12"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "empty tokens decode to empty string",
|
|
53
|
+
"input": "items[3]: a,,c",
|
|
54
|
+
"expected": {
|
|
55
|
+
"items": ["a", "", "c"]
|
|
56
|
+
},
|
|
57
|
+
"specSection": "12",
|
|
58
|
+
"note": "Empty token (nothing between delimiters) decodes to empty string"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "encode",
|
|
4
4
|
"description": "Nested and mixed array encoding - arrays of arrays, mixed type arrays, root arrays",
|
|
5
5
|
"tests": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"pairs": [["a", "b"], ["c", "d"]]
|
|
10
10
|
},
|
|
11
11
|
"expected": "pairs[2]:\n - [2]: a,b\n - [2]: c,d",
|
|
12
|
-
"specSection": "
|
|
12
|
+
"specSection": "9.2"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "quotes strings containing delimiters in nested arrays",
|
|
@@ -17,53 +17,53 @@
|
|
|
17
17
|
"pairs": [["a", "b"], ["c,d", "e:f", "true"]]
|
|
18
18
|
},
|
|
19
19
|
"expected": "pairs[2]:\n - [2]: a,b\n - [3]: \"c,d\",\"e:f\",\"true\"",
|
|
20
|
-
"specSection": "
|
|
20
|
+
"specSection": "9.2"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
"name": "
|
|
23
|
+
"name": "encodes empty inner arrays",
|
|
24
24
|
"input": {
|
|
25
25
|
"pairs": [[], []]
|
|
26
26
|
},
|
|
27
27
|
"expected": "pairs[2]:\n - [0]:\n - [0]:",
|
|
28
|
-
"specSection": "
|
|
28
|
+
"specSection": "9.2"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
"name": "
|
|
31
|
+
"name": "encodes mixed-length inner arrays",
|
|
32
32
|
"input": {
|
|
33
33
|
"pairs": [[1], [2, 3]]
|
|
34
34
|
},
|
|
35
35
|
"expected": "pairs[2]:\n - [1]: 1\n - [2]: 2,3",
|
|
36
|
-
"specSection": "
|
|
36
|
+
"specSection": "9.2"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "encodes root-level primitive array",
|
|
40
40
|
"input": ["x", "y", "true", true, 10],
|
|
41
41
|
"expected": "[5]: x,y,\"true\",true,10",
|
|
42
|
-
"specSection": "
|
|
42
|
+
"specSection": "9.1"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"name": "encodes root-level array of uniform objects in tabular format",
|
|
46
46
|
"input": [{ "id": 1 }, { "id": 2 }],
|
|
47
47
|
"expected": "[2]{id}:\n 1\n 2",
|
|
48
|
-
"specSection": "
|
|
48
|
+
"specSection": "9.3"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"name": "encodes root-level array of non-uniform objects in list format",
|
|
52
52
|
"input": [{ "id": 1 }, { "id": 2, "name": "Ada" }],
|
|
53
53
|
"expected": "[2]:\n - id: 1\n - id: 2\n name: Ada",
|
|
54
|
-
"specSection": "
|
|
54
|
+
"specSection": "9.4"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"name": "encodes empty root-level array",
|
|
58
58
|
"input": [],
|
|
59
59
|
"expected": "[0]:",
|
|
60
|
-
"specSection": "
|
|
60
|
+
"specSection": "9.1"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"name": "encodes root-level arrays of arrays",
|
|
64
64
|
"input": [[1, 2], []],
|
|
65
65
|
"expected": "[2]:\n - [2]: 1,2\n - [0]:",
|
|
66
|
-
"specSection": "
|
|
66
|
+
"specSection": "9.2"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"name": "encodes complex nested structure",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"expected": "user:\n id: 123\n name: Ada\n tags[2]: reading,gaming\n active: true\n prefs[0]:",
|
|
80
|
-
"specSection": "
|
|
80
|
+
"specSection": "8"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"name": "uses list format for arrays mixing primitives and objects",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"items": [1, { "a": 1 }, "text"]
|
|
86
86
|
},
|
|
87
87
|
"expected": "items[3]:\n - 1\n - a: 1\n - text",
|
|
88
|
-
"specSection": "
|
|
88
|
+
"specSection": "9.4"
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"name": "uses list format for arrays mixing objects and arrays",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"items": [{ "a": 1 }, [1, 2]]
|
|
94
94
|
},
|
|
95
95
|
"expected": "items[2]:\n - a: 1\n - [2]: 1,2",
|
|
96
|
-
"specSection": "
|
|
96
|
+
"specSection": "9.4"
|
|
97
97
|
}
|
|
98
98
|
]
|
|
99
99
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "encode",
|
|
4
4
|
"description": "Arrays of objects encoding - list format for non-uniform objects and complex structures",
|
|
5
5
|
"tests": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"expected": "items[2]:\n - id: 1\n name: First\n - id: 2\n name: Second\n extra: true",
|
|
15
|
-
"specSection": "
|
|
15
|
+
"specSection": "9.4"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "uses list format for objects with nested values",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"expected": "items[1]:\n - id: 1\n nested:\n x: 1",
|
|
25
|
-
"specSection": "
|
|
25
|
+
"specSection": "9.4"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"name": "preserves field order in list items - array first",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"items": [{ "nums": [1, 2, 3], "name": "test" }]
|
|
31
31
|
},
|
|
32
32
|
"expected": "items[1]:\n - nums[3]: 1,2,3\n name: test",
|
|
33
|
-
"specSection": "
|
|
33
|
+
"specSection": "10"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"name": "preserves field order in list items - primitive first",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"items": [{ "name": "test", "nums": [1, 2, 3] }]
|
|
39
39
|
},
|
|
40
40
|
"expected": "items[1]:\n - name: test\n nums[3]: 1,2,3",
|
|
41
|
-
"specSection": "
|
|
41
|
+
"specSection": "10"
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"name": "uses list format for objects containing arrays of arrays",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
50
|
"expected": "items[1]:\n - matrix[2]:\n - [2]: 1,2\n - [2]: 3,4\n name: grid",
|
|
51
|
-
"specSection": "
|
|
51
|
+
"specSection": "10"
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"name": "uses tabular format for nested uniform object arrays",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"expected": "items[1]:\n - users[2]{id,name}:\n 1,Ada\n 2,Bob\n status: active",
|
|
61
|
-
"specSection": "
|
|
61
|
+
"specSection": "10"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"name": "uses list format for nested object arrays with mismatched keys",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"expected": "items[1]:\n - users[2]:\n - id: 1\n name: Ada\n - id: 2\n status: active",
|
|
71
|
-
"specSection": "
|
|
71
|
+
"specSection": "10"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"name": "uses list format for objects with multiple array fields",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"items": [{ "nums": [1, 2], "tags": ["a", "b"], "name": "test" }]
|
|
77
77
|
},
|
|
78
78
|
"expected": "items[1]:\n - nums[2]: 1,2\n tags[2]: a,b\n name: test",
|
|
79
|
-
"specSection": "
|
|
79
|
+
"specSection": "10"
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
"name": "uses list format for objects with only array fields",
|
|
@@ -84,17 +84,17 @@
|
|
|
84
84
|
"items": [{ "nums": [1, 2, 3], "tags": ["a", "b"] }]
|
|
85
85
|
},
|
|
86
86
|
"expected": "items[1]:\n - nums[3]: 1,2,3\n tags[2]: a,b",
|
|
87
|
-
"specSection": "
|
|
87
|
+
"specSection": "10"
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
|
-
"name": "
|
|
90
|
+
"name": "encodes objects with empty arrays in list format",
|
|
91
91
|
"input": {
|
|
92
92
|
"items": [
|
|
93
93
|
{ "name": "test", "data": [] }
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
96
|
"expected": "items[1]:\n - name: test\n data[0]:",
|
|
97
|
-
"specSection": "
|
|
97
|
+
"specSection": "10"
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "places first field of nested tabular arrays on hyphen line",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"items": [{ "users": [{ "id": 1 }, { "id": 2 }], "note": "x" }]
|
|
103
103
|
},
|
|
104
104
|
"expected": "items[1]:\n - users[2]{id}:\n 1\n 2\n note: x",
|
|
105
|
-
"specSection": "
|
|
105
|
+
"specSection": "10"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"name": "places empty arrays on hyphen line when first",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"items": [{ "data": [], "name": "x" }]
|
|
111
111
|
},
|
|
112
112
|
"expected": "items[1]:\n - data[0]:\n name: x",
|
|
113
|
-
"specSection": "
|
|
113
|
+
"specSection": "10"
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
"name": "uses field order from first object for tabular headers",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
]
|
|
122
122
|
},
|
|
123
123
|
"expected": "items[2]{a,b,c}:\n 1,2,3\n 10,20,30",
|
|
124
|
-
"specSection": "
|
|
124
|
+
"specSection": "9.3"
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
"name": "uses list format when one object has nested column",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
]
|
|
133
133
|
},
|
|
134
134
|
"expected": "items[2]:\n - id: 1\n data: string\n - id: 2\n data:\n nested: true",
|
|
135
|
-
"specSection": "
|
|
135
|
+
"specSection": "9.4"
|
|
136
136
|
}
|
|
137
137
|
]
|
|
138
138
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "encode",
|
|
4
4
|
"description": "Primitive array encoding - inline arrays of strings, numbers, booleans",
|
|
5
5
|
"tests": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"tags": ["reading", "gaming"]
|
|
10
10
|
},
|
|
11
11
|
"expected": "tags[2]: reading,gaming",
|
|
12
|
-
"specSection": "
|
|
12
|
+
"specSection": "9.1"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "encodes number arrays inline",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"nums": [1, 2, 3]
|
|
18
18
|
},
|
|
19
19
|
"expected": "nums[3]: 1,2,3",
|
|
20
|
-
"specSection": "
|
|
20
|
+
"specSection": "9.1"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"name": "encodes mixed primitive arrays inline",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"data": ["x", "y", true, 10]
|
|
26
26
|
},
|
|
27
27
|
"expected": "data[4]: x,y,true,10",
|
|
28
|
-
"specSection": "
|
|
28
|
+
"specSection": "9.1"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "encodes empty arrays",
|
|
@@ -33,31 +33,31 @@
|
|
|
33
33
|
"items": []
|
|
34
34
|
},
|
|
35
35
|
"expected": "items[0]:",
|
|
36
|
-
"specSection": "
|
|
36
|
+
"specSection": "9.1"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
"name": "
|
|
39
|
+
"name": "encodes empty string in single-item array",
|
|
40
40
|
"input": {
|
|
41
41
|
"items": [""]
|
|
42
42
|
},
|
|
43
43
|
"expected": "items[1]: \"\"",
|
|
44
|
-
"specSection": "
|
|
44
|
+
"specSection": "9.1"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
"name": "
|
|
47
|
+
"name": "encodes empty string in multi-item array",
|
|
48
48
|
"input": {
|
|
49
49
|
"items": ["a", "", "b"]
|
|
50
50
|
},
|
|
51
51
|
"expected": "items[3]: a,\"\",b",
|
|
52
|
-
"specSection": "
|
|
52
|
+
"specSection": "9.1"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
"name": "
|
|
55
|
+
"name": "encodes whitespace-only strings in arrays",
|
|
56
56
|
"input": {
|
|
57
57
|
"items": [" ", " "]
|
|
58
58
|
},
|
|
59
59
|
"expected": "items[2]: \" \",\" \"",
|
|
60
|
-
"specSection": "
|
|
60
|
+
"specSection": "9.1"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"name": "quotes array strings with comma",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"items": ["a", "b,c", "d:e"]
|
|
66
66
|
},
|
|
67
67
|
"expected": "items[3]: a,\"b,c\",\"d:e\"",
|
|
68
|
-
"specSection": "
|
|
68
|
+
"specSection": "9.1"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
"name": "quotes strings that look like booleans in arrays",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"items": ["x", "true", "42", "-3.14"]
|
|
74
74
|
},
|
|
75
75
|
"expected": "items[4]: x,\"true\",\"42\",\"-3.14\"",
|
|
76
|
-
"specSection": "
|
|
76
|
+
"specSection": "9.1"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
"name": "quotes strings with structural meanings in arrays",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"items": ["[5]", "- item", "{key}"]
|
|
82
82
|
},
|
|
83
83
|
"expected": "items[3]: \"[5]\",\"- item\",\"{key}\"",
|
|
84
|
-
"specSection": "
|
|
84
|
+
"specSection": "9.1"
|
|
85
85
|
}
|
|
86
86
|
]
|
|
87
87
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "encode",
|
|
4
4
|
"description": "Tabular array encoding - arrays of uniform objects with primitive values",
|
|
5
5
|
"tests": [
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"expected": "items[2]{sku,qty,price}:\n A1,2,9.99\n B2,1,14.5",
|
|
15
|
-
"specSection": "
|
|
15
|
+
"specSection": "9.3"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"name": "
|
|
18
|
+
"name": "encodes null values in tabular format",
|
|
19
19
|
"input": {
|
|
20
20
|
"items": [
|
|
21
21
|
{ "id": 1, "value": null },
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"expected": "items[2]{id,value}:\n 1,null\n 2,test",
|
|
26
|
-
"specSection": "
|
|
26
|
+
"specSection": "9.3"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"name": "quotes strings containing delimiters in tabular rows",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
"expected": "items[2]{sku,desc,qty}:\n \"A,1\",cool,2\n B2,\"wip: test\",1",
|
|
37
|
-
"specSection": "
|
|
37
|
+
"specSection": "9.3"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
"name": "quotes ambiguous strings in tabular rows",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"expected": "items[2]{id,status}:\n 1,\"true\"\n 2,\"false\"",
|
|
48
|
-
"specSection": "
|
|
48
|
+
"specSection": "9.3"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"name": "
|
|
51
|
+
"name": "encodes tabular arrays with keys needing quotes",
|
|
52
52
|
"input": {
|
|
53
53
|
"items": [
|
|
54
54
|
{ "order:id": 1, "full name": "Ada" },
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
58
|
"expected": "items[2]{\"order:id\",\"full name\"}:\n 1,Ada\n 2,Bob",
|
|
59
|
-
"specSection": "
|
|
59
|
+
"specSection": "9.3"
|
|
60
60
|
}
|
|
61
61
|
]
|
|
62
62
|
}
|