libyang icon indicating copy to clipboard operation
libyang copied to clipboard

tree schema FEATURE emit paths suitable for key search

Open snar opened this issue 9 months ago • 1 comments

Motivation: consider the structure with list hierarchy:

container earth {
  list country {
    key name;
    leaf name {....};
    list city {
      key name;
......

and you want to find cities in some country. Path built with LYSC_PATH_DATA_PATTERN (/earth/country[name='%s']/city[name='%s']/name) can't be used for this task because it contains predicate for city (so you must know it in advance), and path built with LYSC_PATH_DATA (/earth/country/city/name) will find cities in the entrie earth, not limited by country. New LYSC_PATH_KEY_PATTERN will emit /earth/country[name='%s']/city/name here making the task doable.

snar avatar May 11 '25 16:05 snar

I am sorry but I do not see much value in such an addition. There are lots of other path patterns with possible use-cases and none of them supported. So I suppose if you really need such a path, you have to generate it yourself.

michalvasko avatar May 12 '25 09:05 michalvasko