TypeFox / yang-lsp

A Language Server for YANG
http://www.yang-central.org
Apache License 2.0
51 stars 13 forks source link

Serialization of sub module introduces unneccessary prefixing #181

Closed andreasjakobik closed 4 years ago

andreasjakobik commented 4 years ago

Hello,

We have discovered another serialization issue related to sub modules. Input model has a grouping and container like this:

submodule ericsson-nef-submodule-eventexposure {
    yang-version 1.1;

    // module identification
    belongs-to ericsson-nef {
        prefix "nefe";
    }
//…
   grouping nnef-eventexposure {
//…
          container problem-type-uris {
                description "URI to identifies the problem type.";
                list problem-type-uri {
                    key error-code;
                    unique uri;
                    leaf error-code {
                        type int32;
                    }
                    leaf uri {
                        type inet:uri;
                        mandatory true;
                    }
                }
            }
//…
   }
//…
}

However after serialization the key and unique references are prefixed:

submodule ericsson-nef-submodule-eventexposure {
    yang-version 1.1;

    // module identification
    belongs-to ericsson-nef {
        prefix "nefe";
    }
//…

   grouping nnef-eventexposure {
//…
          container problem-type-uris {
                description "URI to identifies the problem type.";
                list problem-type-uri {
                    key nefe:error-code;
                    unique nefe:uri;
                    leaf error-code {
                        type int32;
                    }
                    leaf uri {
                        type inet:uri;
                        mandatory true;
                    }
                }
            }
//…
   }
//…
}

The extra prefixing (key nefe:error-code; and unique nefe:uri;) is surprising and causes a problem with other of our components.

In general serialization should preserv what was originally parsed.

Thanks, Andreas