Include support
oliviermartin opened this issue · 4 comments
As far as I can see the specification does not specify how to include other CDDL files into a CDDL file. Is it expected? It could be expected if the user is responsible to concatenate the CDDL files before processing it.
Complex CDDL description might be easier to read/manage when split into multiple file.
Hi Olivier,
please have a look at https://tools.ietf.org/html/draft-bormann-cbor-cddl-freezer, where we are collecting ideas for the next upgrade of CDDL. E.g., https://tools.ietf.org/html/draft-bormann-cbor-cddl-freezer-01#section-7 talks about a module superstructure, which would probably make more sense than a simple include directive -- where would the file names of the latter point to?
Today (until CDDL grows that feature), we usually concatenate our CDDL files in a Makefile. For an example, see the Makefile in the specification repo: https://github.com/core-wg/senml-spec/blob/master/Makefile#L83
Of course, you can use a more powerful tool than cat
; e.g., I have been using m4
for similar applications (but not recently with CDDL yet).
Thanks for this quick response. I will keep an eye on this next upgrade.
Right. Maybe you can think about what you would like to see in an include or module feature and write this up in a comment for this issue?
Initially I was thinking about a simpler include "file_name"
but thinking about "Module superstructure", maybe it could also be useful to have a namespace