[MDSAL-810] Disambiguate generated classes based on source statement Created: 02/Feb/23 Updated: 05/Feb/23 Resolved: 05/Feb/23 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | Binding codegen |
| Affects Version/s: | None |
| Fix Version/s: | 11.0.6 |
| Type: | Improvement | Priority: | Medium |
| 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 |
|
MDSAL-502 describes a rather ugly case where the original models themselves are generated and use a weird mix of naming. While the complete solution still requires a bijective mapping, that ends up going to Unicode-land for a solution, which will invariably make things very unreadable. We already need to deal with YANG statement namespace overlap, as we are mapping multiple constructs into Java FQCN namespace: identity, feature, container, etc., so we are already equipped to deal with:
module foo {
identity foo;
feature foo;
container foo;
}
This disambiguation stops at schema tree statements vs. others, hence we do not handle this:
module foo {
anydata foo.bar;
anyxml foo-bar;
container Foo.Bar;
list Foo-Bar;
leaf foo.Bar;
leaf-list foo-Bar;
notification Foo.bar;
rpc Foo-bar;
}
and some other cases we generate Java constructs.
We can improve the situation by generalizing over 'class source statement' and assign a $XX suffix, similar to $F, $G, $I, and $YD we already assign. There is already a FIXME to assign two-letter suffixes for a number of these, let's bring this in. The advantage of doing this renaming before MDSAL-502 is that it involves '$', which is not nice, but it does not involve weird Unicode characters (which works, but working with it is a ... memorable .. experience). |