Open abierman opened 7 months ago
What happens if the string matches multiple definitions?
If we allow leaving out prefixes in situations where there is no ambiguity, should we not do this systematically and not just in when/must expressions? Having to remember where I am allowed to leave out prefixes and where not may make it harder to write proper YANG. (I do not know whether any good language servers exist for YANG but tools like that can also take care of getting the details straight.)
I guess we did insist on unambiguous identifiers to prevent situations where an update of an imported module suddenly causes name clashes in importing modules. So it is a question of convenience vs. robustness; if you don't like surprises, better use fully qualified names.
Agree to close this issue. Leaving out the prefix is a common issue. In general we should make YANG easier to use. This would change the meaning of a missing prefix.
Close: complexity: medium, bc: low, importance: low
Sounds like the existing tools are broken...does this indicate a need for a clarification?
Expressions involving identities and equality also miss out on the extensibility built-in to identities. Designers should use the derived-from* family of functions to compare identities. Whatever we decide, we also need to consider XPath evaluation rules, as we don't want to require tool implementers to implement a bastard version of XPath.
Andy: Module designers SHOULD update their modules to always use a prefix (Kent agrees) Jan: be careful changing XPath Andy: should have guidance for compilers to generate warning/errors Rob: should possibly consider replacing XPath Rob: resolution to just update text to provide guidance
Problem
There are several YANG modules that have must/when XPath that compares an identityref leaf to a string literal.
The strict rules in the RFC (sec 9.10) say that the identity (e.g. PROT_OTN) MUST be defined in the current module.
This is often not done.
Solution