This little set of tools provides a number of command line utilities for converting to and from cddl.
gem install cddlc
cddlc knows the following formats:
- .cddl: CDDL as defined in RFC8610
- .cddlj: JSON form of CDDL (the YIN to the YANG)
- .cddly: The same JSON form, but serialized in YAML.
These targets are identified by -t cddl
, -t json
(with -t neat
invoking
a different prettyprinter), -t yaml
. These can be abbreviated (but
don't do that in scripts).
With -t enum
, cddlc generates C-style enumeration type declarations
from integer keys used in a map.
Apart from creating enum declarations, the current version only can transform from input CDDL to one of the JSON/YAML formats of CDDL.
cddlc foo.cddl > foo.cddlj
cddlc -tyaml foo.cddl > foo.cddly
cddlc -ty foo.cddl > foo.cddly
Output is to stdout, input from one or more files given as command line
arguments (use -
for standard input).