[YANGTOOLS-1117] Redefine TypeStatement in terms of QName Created: 02/Jul/20 Updated: 26/Feb/21 Resolved: 26/Feb/21 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0 |
| Type: | Improvement | Priority: | High |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
TypeStatement currently takes String argument, which is not entirely accurate, as it does not provide type expansion required for lookup. This leads to SourceExceptions during building of effective statement rather than a failure to parse the argument when the statement is being defined. Fix the definition of TypeStatement and TypeEffectiveStatement so that these take a QName argument. This leads to the question of which QNameModule should built-in types resolve – and that should be "urn:ietf:params:xml:ns:yang:1", as defined in org.opendaylight.yangtools.yang.model.util.BaseTypes. During unprefixed parsing, hence AbstractTypeStatementSupport needs to account for this manually. |
| Comments |
| Comment by Robert Varga [ 29/Jan/21 ] |
|
This won't work due to polymorphic nature of TypeDefinitions. These two blocks result in different QNames:
leaf foo {
type string;
}
leaf bar {
type string {
pattern "a.c";
}
}
In the first case it resolves to a built-in type, hence it will be have the YANG namespace. In the second case it resolves to a restricted type and it will have the module's namespace. We can consider using AbstractQName and its QualifiedQName/UnqualifiedQName – but it does not seem to be worth the hassle.
|
| Comment by Robert Varga [ 25/Feb/21 ] |
|
Actually this conflating two separate issues:
We need to keep them separate, as the attempts to fuse them via TypeDefinition.copy() effort elsewhere. This issue just needs the QName definition as per description. |