[MDSAL-502] mdsal source generator resolves "-" "_" as the same thing Created: 17/Dec/19 Updated: 25/Jan/24 |
|
| Status: | In Progress |
| Project: | mdsal |
| Component/s: | Binding codegen |
| Affects Version/s: | None |
| Fix Version/s: | 11.0.16 |
| Type: | Bug | Priority: | Medium |
| Reporter: | Miroslav Kovac | Assignee: | Ivan Hrasko |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | pick-next, pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
if we have two grouping with names "my-grouping" and "my_grouping" both of them will be resolved as my_grouping which is wrong. Same thing happens if we have "MyGrp" and "My_grp" example model: module example {
yang-version 1.1;
namespace "urn:opendaylight:params:xml:ns:yang:example";
prefix "example";
revision "2018-05-17" { // TODO change revision to date of model creation
description "Initial revision of example model";
}
grouping MyGrp{
leaf foo {
type string;
}
}
grouping My_grp{
leaf bar {
type string;
}
}
container my_container {
uses MyGrp;
uses My_grp;
}
}
|
| Comments |
| Comment by Robert Varga [ 28/Feb/20 ] |
|
This is actually according to Binding Spec, which was created with the expectation of sane modeling – either use underscores or dashes, not mix them. |
| Comment by Robert Varga [ 03/Feb/21 ] |
|
We'll need to solve this at some point. Some sort of collision avoidance is needed – probably similar to what we do for type/grouping/schemanode conflict resultion. |
| Comment by Robert Varga [ 15/Mar/21 ] |
|
This is slighty related to MDSAL-405 and MDSAL-503 in that in order to resolve this issue we need to have a multi-pass binding-generator-impl – that will give us enough context to deal with this this and other naming conflicts. |
| Comment by Robert Varga [ 19/Jul/21 ] |
|
We now have a multi-pass generator, which performs proper name allocation. Now we need to add a bijective name mapping, which cannot be confused with camel-cases. Probably the best option is to prepend \u00a4 (CURRENCY SIGN, ¤) as the leading character, which is allowed as it is a currency symbol. It is guaranteed to not conflict and can quickly be used to determine that the name requires special handling. The rest of the name should not be touched except for replacement of '.' with \ufe4e (CENTERLINE LOW LINE, ﹎)and '-' with \ufe4d (DASHED LOW LINE, ﹍). This string should then be always used as is, in contexts of package names, property names and class names. |