-
Notifications
You must be signed in to change notification settings - Fork 13
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Mandatory map fields not enforced? #84
Comments
Closing: not a bug. I corrected the CDDL to:
And everything works fine, including detection of mandatory fields. |
The initial instance still should not validate with the initial CDDL, as the mandatory members are not present:
(The rest of the behavior is fine, as Yaron mentioned.) |
(hmm, can't reopen the issue.) |
Per #84 (comment), this is indeed still a bug. Will fix. |
Sorry, you didn't include any test cases in the PR, and I'm unable to generate any cases where the behavior is changed for the CBOR above and various variants. Specifically, the mandatory members are actually present in the CBOR at the top of this issue. Could you please include an example? |
@yaronf my apologies. Merging the PR auto closed the issue. This will be introduced into v0.8.7 of the CLI. Will update the docs and release notes.
should now validate the following:
and this will now be denoted as invalid:
The colon shortcut notation validates the map keys based on their text representation. When used with the double arrow notation, the keys are resolved to the type rules. Prior to merging #86, the CBOR validation implementation in the tool was not properly interpreting the colon shortcut notation. |
Yes, thank you. Agree. Though I had to read the RFC and two of its appendices quite thoroughly to get myself convinced. (Also IMHO this "syntactic sugar" is more pain than it's worth.) |
lol, yea I can't tell you how many times I've read through the RFC since I started this project a few years ago and I STILL misinterpret something. |
On 2021-01-27, at 23:54, Yaron Sheffer ***@***.***> wrote:
(Also IMHO this "syntactic sugar" is more pain than it's worth.)
This ticket may not be the place to argue that, but I’d say: It depends.
For your typical JSON spec, it does make a difference in the noise factor.
See https://tools.ietf.org/html/rfc8610#appendix-H for an example.
For specs with CBOR integer labels like the one we are discussing here, it is indeed another thing that one needs to learn not to stumble over.
Grüße, Carsten
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I have this CBOR (diag notation):
{1: 65535, 2: h'1122334455', 3: 6, }
It validates successfully with this CDDL:
According to @cabo my CDDL is incorrect because it translates to textual, rather than integer, map keys, e.g.
"K_NONCE"
and not 5. My file is accepted because of the "extensions" line. However it should have failed validation anyway, because the first two fields (K_KEY_PROVIDER
andK_KEY_ID
) are mandatory in the schema, but missing from the CBOR file.The text was updated successfully, but these errors were encountered: