cddl 0.8.26 → 0.12.14
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.
- checksums.yaml +4 -4
- data/bin/cddl +19 -3
- data/cddl.gemspec +9 -7
- data/data/cddl.abnf +29 -13
- data/lib/cbor-pp-play.rb +1 -0
- data/lib/cddl.rb +533 -70
- data/test/test-cddl.rb +2 -2
- data/test-data/b64c-sloppy.cddl +1 -0
- data/test-data/b64c.cddl +1 -0
- data/test-data/b64u-strict.cddl +12 -0
- data/test-data/b64u.cddl +1 -0
- data/test-data/base32.cddl +1 -0
- data/test-data/base32hex.cddl +1 -0
- data/test-data/cat-re.cddl +2 -0
- data/test-data/catb64.cddl +8 -0
- data/test-data/decimal-warn.cddl +1 -0
- data/test-data/decimal.cddl +1 -0
- data/test-data/decimal2.cddl +1 -0
- data/test-data/dotplus1.cddl +3 -0
- data/test-data/dotplus2.cddl +3 -0
- data/test-data/dotplus3.cddl +3 -0
- data/test-data/dotplus4.cddl +3 -0
- data/test-data/enum.cddl +14 -0
- data/test-data/enum1.cddl +12 -0
- data/test-data/hex.cddl +1 -0
- data/test-data/hexlc.cddl +1 -0
- data/test-data/hexuc.cddl +1 -0
- data/test-data/join.cddl +1 -0
- data/test-data/joini.cddl +1 -0
- data/test-data/joinx.cddl +1 -0
- data/test-data/json.cddl +1 -0
- data/test-data/json1.cddl +15 -0
- data/test-data/json2.cddl +1 -0
- data/test-data/jwt.cddl +15 -0
- data/test-data/prim.cddl +7 -0
- data/test-data/printf.cddl +2 -0
- data/test-data/printf0.cddl +1 -0
- data/test-data/printf1.cddl +2 -0
- data/test-data/printf2.cddl +2 -0
- data/test-data/printf3.cddl +2 -0
- data/test-data/valemb.cddl +16 -0
- metadata +89 -17
data/test/test-cddl.rb
CHANGED
|
@@ -275,7 +275,7 @@ b = (
|
|
|
275
275
|
(x: int // y: int), z: int
|
|
276
276
|
)
|
|
277
277
|
HERE
|
|
278
|
-
|
|
278
|
+
refute parser.validate_for_test({}, false)
|
|
279
279
|
assert parser.validate_for_test({"x" => 2, "z" => 1})
|
|
280
280
|
assert parser.validate_for_test({"y" => 1, "z" => 2})
|
|
281
281
|
refute parser.validate_for_test({"z" => 1}, false)
|
|
@@ -293,7 +293,7 @@ b = ( z: int
|
|
|
293
293
|
(x: int // y: int)
|
|
294
294
|
)
|
|
295
295
|
HERE
|
|
296
|
-
|
|
296
|
+
refute parser.validate_for_test({}, false)
|
|
297
297
|
assert parser.validate_for_test({"x" => 2, "z" => 1})
|
|
298
298
|
assert parser.validate_for_test({"y" => 1, "z" => 2})
|
|
299
299
|
refute parser.validate_for_test({"z" => 1}, false)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .b64c-sloppy 'mnoabcdue=='
|
data/test-data/b64c.cddl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .b64c 'mnoabcd'
|
data/test-data/b64u.cddl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .b64u 'mnoabcd'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .b32 'mnoabcd'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .h32 'mnoabcd'
|
data/test-data/cat-re.cddl
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
s = [text .decimal 4711, text .base10 4712]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .decimal uint
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .decimal 4711
|
data/test-data/enum.cddl
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
terminal-color = &basecolors
|
|
2
|
+
basecolors = (
|
|
3
|
+
black: 0, red: 1, green: 2, yellow: 3,
|
|
4
|
+
blue: 4, magenta: 5, cyan: 6, white: 7,
|
|
5
|
+
reserved: (8..255) .feature "extension"
|
|
6
|
+
)
|
|
7
|
+
; extended-color = &(
|
|
8
|
+
; basecolors,
|
|
9
|
+
; orange: 8, pink: 9, purple: 10, brown: 11,
|
|
10
|
+
; )
|
|
11
|
+
|
|
12
|
+
;;gp 10
|
|
13
|
+
;;vp 42
|
|
14
|
+
;;vp 433
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
terminal-color = $terminal-color / text .feature "extension"
|
|
2
|
+
$terminal-color /= &basecolors
|
|
3
|
+
basecolors = (
|
|
4
|
+
black: "black", red: "red", green: "green",
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
pastelcolors = ( pink: "pink", mauve: "mauve", peach: "peach", lavender: "lavender" )
|
|
8
|
+
$terminal-color /= &pastelcolors
|
|
9
|
+
|
|
10
|
+
;;gp 10
|
|
11
|
+
;;vp "florp"
|
|
12
|
+
;;vp "lavender"
|
data/test-data/hex.cddl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .hex 'mnoabcd'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .hexlc 'mnoabcd'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .hexuc 'mnoabcd'
|
data/test-data/join.cddl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .join (["a", "b", "c"])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .join (["a", "b", 3])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .join (["a", "b", text])
|
data/test-data/json.cddl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .json ([4, uint .size 1, {"a": "b"}])
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
; JWT-JWS = text .join ([
|
|
2
|
+
; b64u<jwt-headers>, ".",
|
|
3
|
+
; b64u<jwt-payload>, ".",
|
|
4
|
+
; b64u<jwt-signature>])
|
|
5
|
+
; ; a = jwt-headers
|
|
6
|
+
; ; a = b64u<"abc"> ; fails
|
|
7
|
+
; ; a = b64u<'abc'> ; succeeds
|
|
8
|
+
; b64u<B> = text .b64u B
|
|
9
|
+
jwt-headers = '' .cat jwt-headers1
|
|
10
|
+
jwt-headers1 = text .json jwt-headermap
|
|
11
|
+
jwt-headermap = { * text => any } ; simplified
|
|
12
|
+
jwt-payload = bytes
|
|
13
|
+
jwt-signature = bytes
|
|
14
|
+
|
|
15
|
+
;;gp 10
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .json ([4, uint .size 2, {"a": "b"}])
|
data/test-data/jwt.cddl
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
JWT-JWS = text .join ([
|
|
2
|
+
b64u<jwt-headers>, ".",
|
|
3
|
+
b64u<jwt-payload>, ".",
|
|
4
|
+
b64u<jwt-signature>])
|
|
5
|
+
; a = jwt-headers
|
|
6
|
+
; a = b64u<"abc"> ; fails
|
|
7
|
+
; a = b64u<'abc'> ; succeeds
|
|
8
|
+
b64u<B> = text .b64u B
|
|
9
|
+
jwt-headers = '' .cat jwt-headers1
|
|
10
|
+
jwt-headers1 = text .json jwt-headermap
|
|
11
|
+
jwt-headermap = { * text => any } ; simplified
|
|
12
|
+
jwt-payload = bytes
|
|
13
|
+
jwt-signature = bytes
|
|
14
|
+
|
|
15
|
+
;;gp 10
|
data/test-data/prim.cddl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
my_label = text .printf (["0x%x: %a", 4711, 81.5])
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
cwt = [
|
|
2
|
+
bstr .cbor protected-map,
|
|
3
|
+
unprotected-map,
|
|
4
|
+
bstr .cbor payload-map,
|
|
5
|
+
bstr ; signature
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
protected-map = {
|
|
9
|
+
&(alg: 1) => int,
|
|
10
|
+
? &(typ: 16) => text,
|
|
11
|
+
* key => any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
unprotected-map = ()
|
|
15
|
+
key = "key"
|
|
16
|
+
payload-map = { payload: "map"}
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cddl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.12.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carsten Bormann
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: cbor-diag
|
|
@@ -28,18 +27,18 @@ dependencies:
|
|
|
28
27
|
name: abnc
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - "
|
|
30
|
+
- - "~>"
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
32
|
+
version: 0.1.1
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
39
|
+
version: 0.1.1
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
41
|
+
name: json_pure
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
44
|
- - ">="
|
|
@@ -70,16 +69,16 @@ dependencies:
|
|
|
70
69
|
name: regexp-examples
|
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
|
72
71
|
requirements:
|
|
73
|
-
- - "
|
|
72
|
+
- - "~>"
|
|
74
73
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
74
|
+
version: 1.5.1
|
|
76
75
|
type: :runtime
|
|
77
76
|
prerelease: false
|
|
78
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
78
|
requirements:
|
|
80
|
-
- - "
|
|
79
|
+
- - "~>"
|
|
81
80
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
81
|
+
version: 1.5.1
|
|
83
82
|
- !ruby/object:Gem::Dependency
|
|
84
83
|
name: colorize
|
|
85
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -94,6 +93,48 @@ dependencies:
|
|
|
94
93
|
- - ">="
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
95
|
version: '0'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: base32
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0.3'
|
|
103
|
+
type: :runtime
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0.3'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: base45_lite
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '1.0'
|
|
117
|
+
type: :runtime
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '1.0'
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: scanf
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '1.0'
|
|
131
|
+
type: :runtime
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - "~>"
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '1.0'
|
|
97
138
|
description: A parser, generator, and validator for CDDL
|
|
98
139
|
email: cabo@tzi.org
|
|
99
140
|
executables:
|
|
@@ -119,13 +160,20 @@ files:
|
|
|
119
160
|
- test-data/abnf3.cddl
|
|
120
161
|
- test-data/ambig.cddl
|
|
121
162
|
- test-data/b.cddl
|
|
163
|
+
- test-data/b64c-sloppy.cddl
|
|
164
|
+
- test-data/b64c.cddl
|
|
165
|
+
- test-data/b64u-strict.cddl
|
|
166
|
+
- test-data/b64u.cddl
|
|
122
167
|
- test-data/badaddr.cddl
|
|
168
|
+
- test-data/base32.cddl
|
|
169
|
+
- test-data/base32hex.cddl
|
|
123
170
|
- test-data/basic_syntax_example.cddl
|
|
124
171
|
- test-data/bat.cddl
|
|
125
172
|
- test-data/bpv7.cddl
|
|
126
173
|
- test-data/bpv7a.cddl
|
|
127
174
|
- test-data/bpv7b.cddl
|
|
128
175
|
- test-data/cat-re.cddl
|
|
176
|
+
- test-data/catb64.cddl
|
|
129
177
|
- test-data/cdni-ct.cddl
|
|
130
178
|
- test-data/complex-occ.cddl
|
|
131
179
|
- test-data/coral.cddl
|
|
@@ -135,8 +183,17 @@ files:
|
|
|
135
183
|
- test-data/cose.cddl
|
|
136
184
|
- test-data/dcaf.cddl
|
|
137
185
|
- test-data/dcaf1.cddl
|
|
186
|
+
- test-data/decimal-warn.cddl
|
|
187
|
+
- test-data/decimal.cddl
|
|
188
|
+
- test-data/decimal2.cddl
|
|
138
189
|
- test-data/det1.cddl
|
|
190
|
+
- test-data/dotplus1.cddl
|
|
191
|
+
- test-data/dotplus2.cddl
|
|
192
|
+
- test-data/dotplus3.cddl
|
|
193
|
+
- test-data/dotplus4.cddl
|
|
139
194
|
- test-data/dotsize.cddl
|
|
195
|
+
- test-data/enum.cddl
|
|
196
|
+
- test-data/enum1.cddl
|
|
140
197
|
- test-data/extractor-demo.cddl
|
|
141
198
|
- test-data/feat1.cddl
|
|
142
199
|
- test-data/feature-controller.cddl
|
|
@@ -148,6 +205,9 @@ files:
|
|
|
148
205
|
- test-data/grasp-09.cddl
|
|
149
206
|
- test-data/grasp-v1.cddl
|
|
150
207
|
- test-data/grasp-v2X.cddl
|
|
208
|
+
- test-data/hex.cddl
|
|
209
|
+
- test-data/hexlc.cddl
|
|
210
|
+
- test-data/hexuc.cddl
|
|
151
211
|
- test-data/homenet-de.cddl
|
|
152
212
|
- test-data/homenet-fe.cddl
|
|
153
213
|
- test-data/ifmap-base-2.0v17.cddl
|
|
@@ -157,7 +217,14 @@ files:
|
|
|
157
217
|
- test-data/jcr-ex.cddl
|
|
158
218
|
- test-data/jim-cut-2.cddl
|
|
159
219
|
- test-data/jim-cut.cddl
|
|
220
|
+
- test-data/join.cddl
|
|
221
|
+
- test-data/joini.cddl
|
|
222
|
+
- test-data/joinx.cddl
|
|
223
|
+
- test-data/json.cddl
|
|
224
|
+
- test-data/json1.cddl
|
|
225
|
+
- test-data/json2.cddl
|
|
160
226
|
- test-data/jsoniodef.cddl
|
|
227
|
+
- test-data/jwt.cddl
|
|
161
228
|
- test-data/kevin5.cddl
|
|
162
229
|
- test-data/lint1.cddl
|
|
163
230
|
- test-data/map-group.cddl
|
|
@@ -178,6 +245,12 @@ files:
|
|
|
178
245
|
- test-data/oidbat.cddl
|
|
179
246
|
- test-data/patch1.cddl
|
|
180
247
|
- test-data/plus.cddl
|
|
248
|
+
- test-data/prim.cddl
|
|
249
|
+
- test-data/printf.cddl
|
|
250
|
+
- test-data/printf0.cddl
|
|
251
|
+
- test-data/printf1.cddl
|
|
252
|
+
- test-data/printf2.cddl
|
|
253
|
+
- test-data/printf3.cddl
|
|
181
254
|
- test-data/reused_named_group.cddl
|
|
182
255
|
- test-data/sasl.cddl
|
|
183
256
|
- test-data/sequence.cddl
|
|
@@ -190,6 +263,7 @@ files:
|
|
|
190
263
|
- test-data/toerless0.cddl
|
|
191
264
|
- test-data/toerless1.cddl
|
|
192
265
|
- test-data/two_anonymous_groups.cddl
|
|
266
|
+
- test-data/valemb.cddl
|
|
193
267
|
- test-data/wrong1.cddl
|
|
194
268
|
- test-data/wrong1a.cddl
|
|
195
269
|
- test-data/wrong2.cddl
|
|
@@ -198,11 +272,10 @@ files:
|
|
|
198
272
|
- test-data/yangid.cddl
|
|
199
273
|
- test-data/yaron1.cddl
|
|
200
274
|
- test/test-cddl.rb
|
|
201
|
-
homepage:
|
|
275
|
+
homepage: https://www.rfc-editor.org/rfc/rfc8610#appendix-F
|
|
202
276
|
licenses:
|
|
203
277
|
- MIT
|
|
204
278
|
metadata: {}
|
|
205
|
-
post_install_message:
|
|
206
279
|
rdoc_options: []
|
|
207
280
|
require_paths:
|
|
208
281
|
- lib
|
|
@@ -210,15 +283,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
210
283
|
requirements:
|
|
211
284
|
- - ">="
|
|
212
285
|
- !ruby/object:Gem::Version
|
|
213
|
-
version: '2.
|
|
286
|
+
version: '2.3'
|
|
214
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
288
|
requirements:
|
|
216
289
|
- - ">="
|
|
217
290
|
- !ruby/object:Gem::Version
|
|
218
291
|
version: '0'
|
|
219
292
|
requirements: []
|
|
220
|
-
rubygems_version:
|
|
221
|
-
signing_key:
|
|
293
|
+
rubygems_version: 4.0.8
|
|
222
294
|
specification_version: 4
|
|
223
295
|
summary: CDDL generator and validator.
|
|
224
296
|
test_files: []
|