Unique statement for case/choice leaves

In a list I’d like the leaves under a required choice/case statement to be unique. Is it allowed? I couldn’t make it work (“internal error”), either by splitting it into two unique statements (debatable) or putting everything into one, which in theory should make sense, as in the example below:

list my-list-element {
      key "name";
      // unique statement below won't work!
      unique "a b c";
      

      leaf name {
        type string;
        description "A name for the list element";
      }
      
      choice a-or-b-c {
        mandatory true;
        case choose-a {
          leaf a {
            type string;
            description
              "leaf A";
          }
        }
        case choose-b-c {
          leaf b {
            type string;
            description
              "leaf B";
          }
          leaf c {
            type string;
            description
              "leaf C";
          }
        }
      }
    }

The unique statement takes as an argument a string that contains a space-separated list of schema node identifiers, Each such schema node identifier MUST refer to a leaf. I.e. not a leaf in a choice, container, list, etc.

See RFC 7950 https://tools.ietf.org/html/rfc7950#section-7.8.3

1 Like