[NETCONF-1060] OpenApi: Broken parameters logic Created: 19/Jun/23  Updated: 14/Jul/23  Resolved: 14/Jul/23

Status: Resolved
Project: netconf
Component/s: restconf-openapi
Affects Version/s: 6.0.0
Fix Version/s: 7.0.0, 6.0.1

Type: Bug Priority: Medium
Reporter: Ivan Hrasko Assignee: Yaroslav Lastivka
Resolution: Done Votes: 0
Labels: pt, regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

We have the following YANG model:

module keys-mapping {
  namespace "mapping";
  prefix keys-mappin;

  revision "2023-06-19" {
    description
      "Sample app";
  }

  list multiple-key-list {
    key "name name2";
    leaf name {
      type string;
    }
    leaf name2 {
      type string;
    }
    list multiple-key-list2 {
      key "name name3";
      leaf name {
        type string;
      }
      leaf name3 {
        type string;
      }
      list multiple-key-list3 {
        key "name3 name";
        leaf name3 {
          type string;
        }
        leaf name {
          type string;
        }
        list multiple-key-list4 {
          key name;
          leaf name {
            type string;
          }
        }
      }
    }
  }
}

In OpenApi docs we are getting URLs as follows:

/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount/keys-mapping:multiple-key-list={name},{name2}/multiple-key-list2={name1},{name3}/multiple-key-list3={name31},{name4}/multiple-key-list4={name2}

It means we have two times parameter called name2. This OpenAPi model is invalid. We have to change our logic to preserve discriminator value when going deeper into lists structure.

 



 Comments   
Comment by Ivan Hrasko [ 19/Jun/23 ]

Expected path is:

/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount/keys-mapping:multiple-key-list={name},{name2}/multiple-key-list2={name1},{name3}/multiple-key-list3={name31},{name4}/multiple-key-list4={name5}
Comment by Ivan Hrasko [ 19/Jun/23 ]

The logic has been broken in NETCONF-1047. We do not want to make revert. Instead, fix current logic and add unit tests.

Generated at Wed Feb 07 20:16:34 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.