Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1545

Min/max-elements are not enforced for wrapped elements in container

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • 11.0.2
    • None

      Currently, it is possible to create a list/leaf-list with min-elements and max-element violations if those elements are wrapped with a container in the payload.

      For example in this model:

      module test-container-childs {
          namespace "http://example.com/test/container/child";
          prefix "tcc";
          revision 2023-09-28;
      
          container root-container {
              container nested-container {
                  list mandatory-list {
                      min-elements 1;
                      max-elements 3;
                      key id;
                      leaf id {
                          type uint32;
                      }
                  }
              }
          }
      }

       

      It is allowed to create 0 list resources or more than 3, if the list `mandatory-list` is wrapped with "nested-container" in the payload:

      {
          "nested-container": {
              "mandatory-list": []
          }
      }

      The same issue is present for the leaf-list element.

       

      This issue was already reported before, and resolved:
      https://jira.opendaylight.org/browse/YANGTOOLS-776

            ivanhrasko Ivan Hrasko
            PeterSuna Peter Suna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: