xpath UPDATE to support usage of union types as deref targets#2431
Conversation
|
Just some comments on current behavior of libyang. Current version doesn't allows to deref any type of node, just the valid ones, which contradicts the RFC 7950, which says that it should support it but return empty set. I understand that RFC7950 doesn't explicitly allows usage of unions as deref target nodes, but it make sense in case when you have scenario when yang model allows usage of predefined set of data and refer to it using leafref, and also allows to use completely custom set, using the same kind data model as for predefined ones... on top of that there might be some data which is never predefined and therefore it can have two possible paths to reference some data. Either through predefined set or through custom. Here is a yang model to better explain this: I know that I have introduced union of leafref and string together, which could be just "optional" leafref. In my case this is not possible as empty value would automatically be consider by UI layer in my project that user wishes to create custom data, which quite a lot of data. This creates user experience to see what all details are needed if he/she wants to defined it manually, and should rather use predefined set. Once he/she changed that UI will hide not needed staff leaving just the additional selected data field to be filled in by user. So we have to introduce something like string literal value, which is not supported by YANG natively, therefore this trick with |
bd85a76 to
578357b
Compare
michalvasko
left a comment
There was a problem hiding this comment.
Thanks, seems fine, just some minor issues.
This patch introduces ability to use union types, which internally uses leafrefs to be used as deref target nodes. This fullfils the last statement of RFC 7950 section 10.3.1. This behavior is also allowed within leafref paths which uses deref function in it. This patch also fixes segfault in case of using cyclic deref paths
578357b to
6afbaad
Compare
This patch introduces ability to use union types, which internally uses leafrefs to be used as deref target nodes. This fullfils the last statement of RFC 7950 section 10.3.1. This behavior is also allowed within leafref paths which uses deref function in it.
This patch also fixes segfault in case of using cyclic deref paths