Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-810

Disambiguate generated classes based on source statement

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 11.0.6
    • None
    • Binding codegen
    • None

      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).

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: