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

YANG when condition evaluated as false combined with a mandatory leaf does not work #380

Closed
olofhagsand opened this issue Oct 17, 2022 · 0 comments

Comments

@olofhagsand
Copy link
Member

A construct with a conditiona (using when) container with a mandatory leaf does not work when the when condition evaluates as false.
Example:

container c {
   when ../id='true';
   leaf x {
      type string;
      mandatory true;
   }

If the when condition evaluates to false, x is still required at validation.
This fails RFC 7950 Sec 8.1:

The "mandatory" constraint is enforced for leafs and choices, unless the node
or any of its ancestors has a "when" condition ... that evaluates to "false".

olofhagsand added a commit that referenced this issue Oct 17, 2022
…ory leaf does not work](#380)

Replaced yang_mandatory() with yang_xml_mandatory() by extending existing it with when check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant