Open rgwilton opened 4 years ago
I like this proposal. I also think we could consider to add "when" substatement under import statement to check the path dependency, e.g., if the imported data node within specific path from another module doesn't exist, such module will not be imported and implemented.
At first this looks easy but it is not always. The YANG library is where import-only is specified. This is only relevant for modules that contain abstract and real identifiers.
The use-case here is for a new module that wants to just use the abstract identifiers from an existing module that is mixed.
import for augment and leafref always requires the imported module to be implemented
import foo {
prefix foo;
abstract-only true; // default false
}
abstract-only = false
abstract-only = true: abstract import only
It is an error if the importing module augments the imported module. How does this work with groupings and the import of groupings via multiple modules? This seems too complex to enforce.
e.g.
More Discuss: complexity: high, bc: high, importance: medium
Today, when a module imports another module it isn't made explicit whether that import is to fulfill a path or identity dependency or simply for a typedef dependency.
Whilst working on YANG packages, I've began to think that it might be helpful to allow import statements to be annotated to indicate that it only imports type definitions, making the relationship between YANG modules a bit more clear. E.g. readers of the YANG module would be able to know that they don't need to implement the imported module. If this filter/annotation is defined then the intention is that it should be directly equivalent to an "import-only" YANG module in YANG library.