-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid CDDL or RFC Interpretation Issues? #347
Comments
They are right that it is invalid CDDL. zcbor's understanding of labels/keys is flawed, but "fixing" it would be more complicated and less useful/flexible than the way it is now, so for the time being it hasn't been fixed. I'm basically still deciding how to proceed. To briefly describe the difference: zcbor treats labels as separate from map keys. This means you can label a key:value pair in a map. Conversely, the CDDL spec doesn't really have labels, rather it allows both list members and map members to have keys, it's just that in lists, they are ignored in the data, i.e. they can be used as labels. This means you basically can't label anything in maps because having two nested keys is not ok. It also means you can't label anything (like a group or a choice) that already contains a label for one of its members.
It also results in some weird cases where if you create a group where members have keys, the keys will be labels if placed in a list, but actual keys if placed in a map.
I welcome anyone's opinions on how you use zcbor, and whether you prefer correctness, or keeping the current state. Though I suspect zcbor will eventually move to be more in line with the CDDL spec. |
If it isn't to spec, and it's going to have to change, the second best time to do it is now. No point in putting it off. This is what forks and previous commits are for. |
A spec is only valuable if its followed. I want to be able to use the same CDDL to generate C code using zcbor and to feed into other CBOR libraries for other systems. But I'm spending more time fighting with zcbor to get it to accept CDDL that is valid and accepted by other CBOR libraries. |
I have some CDDL that successfully runs through zcbor, but I have now been trying to use cddl-rs (https://docs.rs/cddl/latest/cddl/ and https://github.com/anweiss/cddl) which uses cddl-codegen (https://github.com/dcSpark/cddl-codegen) and have been encountering errors with both my CDDL and some zcbor's test case files.
They are claiming here (dcSpark/cddl-codegen#201) and here (anweiss/cddl#199) that some of it might be invalid CDDL. I'm not attempting to start any kind of battle, but I am wondering if there are some interpretation differences of the RFC that is causing confusion. I was hoping someone could explain why the CDDL test cases are considered valid by zcbor.
Example:
The text was updated successfully, but these errors were encountered: