Skip to content
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

Dictionary elements outside schema are tolerated #221

Open
chrysn opened this issue Feb 26, 2024 · 0 comments
Open

Dictionary elements outside schema are tolerated #221

chrysn opened this issue Feb 26, 2024 · 0 comments

Comments

@chrysn
Copy link

chrysn commented Feb 26, 2024

Given this test.cddl:

root = {}

and this JSON

{"x": "y"}

this crate's tool validates it:

$ cddl validate  --cddl test.cddl --json test.json
[INFO] Root type for validation: root
[INFO] Validation of "test.json" is successful

while the competing validators complain:

$ zcbor validate -c test.cddl -t root -i test.json
[...]
zcbor.zcbor.zcbor.CddlValidationError: Iterator not consumed while parsing 
//MAP
Remaining elements:
 elem: ('x', 'y')
$ ~/.gem/ruby/3.1.0/bin/cddl test.cddl validate test.json
CDDL validation failure (nil for {"x"=>"y"}):
[{"x"=>"y"}, [:map], ""]
[{"x": "y"}, [:map], ""]

Given that a CDDL is supposed to be comprehensive [citation missing], I think that the other tools are right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant