netmod-wg / yang-next

Feature requests for future versions of YANG
6 stars 0 forks source link

Clarify the behavior if the schema nodes in XPath expression are un-supported #116

Open lllyfeng opened 1 year ago

lllyfeng commented 1 year ago

If the schema nodes in XPath expression are un-supported by deviation, should the YANG parser report error?

If YANG parser report error, user have to also change the XPath expression by deviation (if it’s ‘when’, it can not be deviated.) If YANG parser don’t report error, the evaluation of XPath expression MAY cause unexpected result.

for example:

container a {
    leaf b {...}
    leaf c {
      must "../b > current()";
      ...
   }
}

if using deviation to delete leaf b

deviation "a/b" {
    deviate not-supported;
}

YANG Parser should report error for the leaf b in must expression of leaf c not exists? if YANG parser don't report error, the evaluation of the must may always false.

abierman commented 2 months ago

Agree with this ticket. Clarify that it is a warning for must/when to reference unknown or removed nodes

Requires standard YANG Compiler Warnings, which should be a goal of YANG 2.0

It is not an error to have XPath that has unknown nodes. It is an error for a leafref path-stmt, but not must/when.

The YANG compiler should print a warning that the must-expr has unknown nodes in it.

XPath has rules for converting an empty node-set to a number. The expression evaluation should not cause an error.

Must Do: complexity: medium, bc: high, importance: medium

janlindblad commented 2 months ago

Always good to clarify, but I'm not sure I want to change XPath evaluation behavior for unknown nodes.

BalazsLengyel commented 1 month ago

Support the issue to be solved.