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

Validation of optional fields referring to choices inappropriately fails #139

Closed
whimboo opened this issue Sep 30, 2022 · 3 comments · Fixed by #142
Closed

Validation of optional fields referring to choices inappropriately fails #139

whimboo opened this issue Sep 30, 2022 · 3 comments · Fixed by #142
Assignees
Labels
bug Something isn't working validation
Milestone

Comments

@whimboo
Copy link

whimboo commented Sep 30, 2022

Trying to validate the following JSON file against the given CDDL definition fails. As it looks like there is a problem with the optional occurrence indicator (including *, + as well) because removing it will succeed the validation.

{
  "name": "foo",
  "valid": "no"
}
Argument = {
  name: text,
  ?valid: "yes" / "no"
}

The visible failure:

[ERROR] Validation of "data.json" failed: error validating type choice at the root of the JSON document: unexpected key "valid"

Removing the question mark it succeeds:

[INFO] Validation of "data.json" is successful
@anweiss anweiss self-assigned this Oct 3, 2022
@anweiss anweiss added the bug Something isn't working label Oct 3, 2022
@anweiss anweiss added this to the v1.0.0 milestone Oct 3, 2022
@anweiss
Copy link
Owner

anweiss commented Oct 3, 2022

Thanks for reporting @whimboo. Oversight on my part when implementing #138.

anweiss added a commit that referenced this issue Oct 3, 2022
anweiss added a commit that referenced this issue Oct 3, 2022
anweiss added a commit that referenced this issue Oct 3, 2022
@whimboo
Copy link
Author

whimboo commented Oct 4, 2022

Thanks for reporting @whimboo. Oversight on my part when implementing #138.

You are welcome. Interesting for me is that #138 landed post 0.9.0 but I can see the issue with that given release.

@anweiss
Copy link
Owner

anweiss commented Oct 4, 2022

Yea, I was too quick to get 0.9.0 out the door since it had been lingering for so long. This will make it into 0.9.1.

anweiss added a commit that referenced this issue Oct 4, 2022
anweiss added a commit that referenced this issue Oct 4, 2022
anweiss added a commit that referenced this issue Oct 4, 2022
anweiss added a commit that referenced this issue Oct 4, 2022
anweiss added a commit that referenced this issue Oct 14, 2022
anweiss added a commit that referenced this issue Oct 14, 2022
anweiss added a commit that referenced this issue Oct 20, 2022
anweiss added a commit that referenced this issue Oct 25, 2022
anweiss added a commit that referenced this issue Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants