ietf-rats / ietf-corim-cddl

This repository is abandoned. The adopted I-D can be found at:
https://github.com/ietf-rats-wg/draft-ietf-rats-corim/
2 stars 0 forks source link

avoid empty objects when all elements are optional #18

Closed thomas-fossati closed 3 years ago

thomas-fossati commented 3 years ago

There are a few objects definitions where all elements are optional. The list currently includes, claims-map, element-name-map, element-value-map. If we intend these to be populated with at least one element, we could add the following CDDL:

non-empty<M> = (M) .and ({ + any => any })

and then:

? comid.claims => non-empty<claims-map>
nedmsmith commented 3 years ago

Yes, the intent is for maps that are all optional to have one or more provided values. The normative language in referencing specifications is intended as the way to capture these requirements. It is nevertheless appropriate for the parser to throw an error if there is an empty structure (I think). I'm weary of too many CDDL-isms creeping into the specification that makes it more difficult for non-experts to comprehend. Though "non-empty" seems pretty benign.