Skip to content

yanglint can't find absolute path leafref target when defined within sx:augment-structure #2375

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

Open
ksallberg opened this issue Mar 31, 2025 · 1 comment
Labels
is:bug Bug description. status:invalid Issue is not reproducible or the behavior is intended.

Comments

@ksallberg
Copy link

ksallberg commented Mar 31, 2025

Reproducible with: yanglint 3.7.8

This YANG should be valid AFAICT but yanglint can't find the leafref's target:

module example {
  yang-version 1.1;
  namespace "ex:ample";
  prefix example;

  import ietf-yang-structure-ext {
    prefix sx;
  }

  container files {
    list file {
      key id;

      leaf id {
        type uint32;
      }
    }
  }

  sx:structure struct {
    container c {
    }
  }

  sx:augment-structure "/example:struct/c" {
    leaf id {
      type leafref {
        path "/example:files/example:file/example:id";
      }
    }
  }
}

yanglint example.yang
libyang err : Not found node "files" in path. (/example:c/id)

@michalvasko
Copy link
Member

I do not think standard YANG nodes are accessible from structures and vice versa, for XPath purposes based on the following text from ietf-yang-structure-ext:

       The XPath document element is the extension statement itself,
       such that the child nodes of the document element are
       represented by the data-def-stmt substatements within this
       extension.  This conceptual document is the context for the
       following YANG statements:

         - must-stmt
         - when-stmt
         - path-stmt
         - min-elements-stmt
         - max-elements-stmt
         - mandatory-stmt
         - unique-stmt
         - ordered-by
         - instance-identifier data type

@michalvasko michalvasko added is:bug Bug description. status:invalid Issue is not reproducible or the behavior is intended. labels Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Bug description. status:invalid Issue is not reproducible or the behavior is intended.
Projects
None yet
Development

No branches or pull requests

2 participants