[NETCONF-1023] OpenAPI: Limit usage of JsonUtil#copy method Created: 10/May/23  Updated: 14/Jun/23  Resolved: 23/May/23

Status: Resolved
Project: netconf
Component/s: restconf-openapi
Affects Version/s: None
Fix Version/s: 6.0.0

Type: Improvement Priority: Medium
Reporter: Ivan Hrasko Assignee: Oleksandr Zharov
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to NETCONF-938 Cannot generate API docs for Junos de... In Review

 Description   

The addPaths method is the only place where we need to make a copy of parameters because we are going deeper into recursion. Thus we need
some defence against future modifications.

The other methods buildPost, buildGet, buildPut and buildDelete are doing unnecessary copying.

The second problem is that we do not have any unit test to check the number of parameters in recursive models, for example:

  container container-root {
    list root-list {
      key name;
      leaf name {
        type string;
      }      list nested-list {
        key name;
        leaf name {
          type string;
        }        list super-nested-list {
          key name;
          leaf name {
            type string;
          }
        }
      }
    }
  }


 Comments   
Comment by Ivan Hrasko [ 22/May/23 ]

We have found out that we cannot get rid of copying. But we can use ArrayNode#addAll instead of JsonUtil#copy.

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