Tests improvement for duplicated schemas 30/111230/4
authorSamuel Schneider <samuel.schneider@pantheon.tech>
Wed, 3 Apr 2024 16:15:50 +0000 (18:15 +0200)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Tue, 14 May 2024 13:15:27 +0000 (13:15 +0000)
Improve test for duplicated schemas to better test
usage of discriminator.

JIRA: NETCONF-1270
Change-Id: I7cabefed15a798b89d200cf6338a65253d89c5c6
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
restconf/restconf-openapi/src/test/resources/yang-document/controller-all.json
restconf/restconf-openapi/src/test/resources/yang-document/controller-duplication-test.json
restconf/restconf-openapi/src/test/resources/yang-document/device-all.json
restconf/restconf-openapi/src/test/resources/yang-document/device-duplication-test.json
restconf/restconf-openapi/src/test/resources/yang/duplication-service.yang
restconf/restconf-openapi/src/test/resources/yang/duplication-test.yang

index 96bac1010af8d791de8d13fcd20847844b45ca23..1c7e61db12a3fd19a0c807f4a6b4e2ecb2af0fb1 100644 (file)
           "Controller duplication-test"
         ]
       }
+    },
+    "/rests/operations/duplication-test:test-rpc3": {
+      "post": {
+        "description": "",
+        "summary": "POST - Controller - duplication-test - test-rpc3",
+        "requestBody": {
+          "description": "test-rpc3_input",
+          "content": {
+            "application/json": {
+              "schema": {
+                "properties": {
+                  "input": {
+                    "$ref": "#/components/schemas/duplication-test_test-rpc3_input",
+                    "type": "object"
+                  }
+                }
+              }
+            },
+            "application/xml": {
+              "schema": {
+                "$ref": "#/components/schemas/duplication-test_test-rpc3_input"
+              }
+            }
+          }
+        },
+        "responses": {
+          "204": {
+            "description": "RPC test-rpc3 success"
+          }
+        },
+        "tags": [
+          "Controller duplication-test"
+        ],
+        "parameters": []
+      }
     }
   },
   "components": {
           "name": "input",
           "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
         }
+      },
+      "duplication-test_test-rpc3_input": {
+        "title": "duplication-test_test-rpc3_input",
+        "type": "object",
+        "properties": {
+          "input-leaf": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf"
+          },
+          "first": {
+            "$ref": "#/components/schemas/duplication-test_first1"
+          }
+        },
+        "xml": {
+          "name": "input",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
+        }
+      },
+      "duplication-test_first1": {
+        "title": "duplication-test_first",
+        "type": "object",
+        "properties": {
+          "input-leaf1": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf1"
+          }
+        },
+        "xml": {
+          "name": "first",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:service"
+        }
       }
     },
     "securitySchemes": {
index ea2341c1af97f878c85d06535de818cfbed7c28e..672be176fd011869ffe31e26b261164de115da06 100644 (file)
         ],
         "parameters": []
       }
+    },
+    "/rests/operations/duplication-test:test-rpc3": {
+      "post": {
+        "description": "",
+        "summary": "POST - Controller - duplication-test - test-rpc3",
+        "requestBody": {
+          "description": "test-rpc3_input",
+          "content": {
+            "application/json": {
+              "schema": {
+                "properties": {
+                  "input": {
+                    "$ref": "#/components/schemas/duplication-test_test-rpc3_input",
+                    "type": "object"
+                  }
+                }
+              }
+            },
+            "application/xml": {
+              "schema": {
+                "$ref": "#/components/schemas/duplication-test_test-rpc3_input"
+              }
+            }
+          }
+        },
+        "responses": {
+          "204": {
+            "description": "RPC test-rpc3 success"
+          }
+        },
+        "tags": [
+          "Controller duplication-test"
+        ],
+        "parameters": []
+      }
     }
   },
   "components": {
           "name": "input",
           "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
         }
+      },
+      "duplication-test_test-rpc3_input": {
+        "title": "duplication-test_test-rpc3_input",
+        "type": "object",
+        "properties": {
+          "input-leaf": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf"
+          },
+          "first": {
+            "$ref": "#/components/schemas/duplication-test_first1"
+          }
+        },
+        "xml": {
+          "name": "input",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
+        }
+      },
+      "duplication-test_first1": {
+        "title": "duplication-test_first",
+        "type": "object",
+        "properties": {
+          "input-leaf1": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf1"
+          }
+        },
+        "xml": {
+          "name": "first",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:service"
+        }
       }
     },
     "securitySchemes": {
index 6a97c2ce294ec765411baeae5f917ba65184a7cb..95bb97b23172fcb27aca6e0cd85dcc90a65413a2 100644 (file)
           "123 duplication-test"
         ]
       }
+    },
+    "/rests/operations/nodes/node=123/yang-ext:mount/duplication-test:test-rpc3": {
+      "post": {
+        "description": "",
+        "summary": "POST - 123 - duplication-test - test-rpc3",
+        "requestBody": {
+          "description": "test-rpc3_input",
+          "content": {
+            "application/json": {
+              "schema": {
+                "properties": {
+                  "input": {
+                    "$ref": "#/components/schemas/duplication-test_test-rpc3_input",
+                    "type": "object"
+                  }
+                }
+              }
+            },
+            "application/xml": {
+              "schema": {
+                "$ref": "#/components/schemas/duplication-test_test-rpc3_input"
+              }
+            }
+          }
+        },
+        "responses": {
+          "204": {
+            "description": "RPC test-rpc3 success"
+          }
+        },
+        "tags": [
+          "123 duplication-test"
+        ],
+        "parameters": []
+      }
     }
   },
   "components": {
           "name": "input",
           "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
         }
+      },
+      "duplication-test_test-rpc3_input": {
+        "title": "duplication-test_test-rpc3_input",
+        "type": "object",
+        "properties": {
+          "input-leaf": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf"
+          },
+          "first": {
+            "$ref": "#/components/schemas/duplication-test_first1"
+          }
+        },
+        "xml": {
+          "name": "input",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
+        }
+      },
+      "duplication-test_first1": {
+        "title": "duplication-test_first",
+        "type": "object",
+        "properties": {
+          "input-leaf1": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf1"
+          }
+        },
+        "xml": {
+          "name": "first",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:service"
+        }
       }
     },
     "securitySchemes": {
index 106fe112a9d59fb88426cacde78693b8b787c4a2..2424e5c70e321906d0a728ff7449c445a53cb0d7 100644 (file)
         ],
         "parameters": []
       }
+    },
+    "/rests/operations/nodes/node=123/yang-ext:mount/duplication-test:test-rpc3": {
+      "post": {
+        "description": "",
+        "summary": "POST - 123 - duplication-test - test-rpc3",
+        "requestBody": {
+          "description": "test-rpc3_input",
+          "content": {
+            "application/json": {
+              "schema": {
+                "properties": {
+                  "input": {
+                    "$ref": "#/components/schemas/duplication-test_test-rpc3_input",
+                    "type": "object"
+                  }
+                }
+              }
+            },
+            "application/xml": {
+              "schema": {
+                "$ref": "#/components/schemas/duplication-test_test-rpc3_input"
+              }
+            }
+          }
+        },
+        "responses": {
+          "204": {
+            "description": "RPC test-rpc3 success"
+          }
+        },
+        "tags": [
+          "123 duplication-test"
+        ],
+        "parameters": []
+      }
     }
   },
   "components": {
           "name": "input",
           "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
         }
+      },
+      "duplication-test_test-rpc3_input": {
+        "title": "duplication-test_test-rpc3_input",
+        "type": "object",
+        "properties": {
+          "input-leaf": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf"
+          },
+          "first": {
+            "$ref": "#/components/schemas/duplication-test_first1"
+          }
+        },
+        "xml": {
+          "name": "input",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:test"
+        }
+      },
+      "duplication-test_first1": {
+        "title": "duplication-test_first",
+        "type": "object",
+        "properties": {
+          "input-leaf1": {
+            "description": "",
+            "type": "string",
+            "example": "Some input-leaf1"
+          }
+        },
+        "xml": {
+          "name": "first",
+          "namespace": "urn:ietf:params:xml:ns:yang:test:duplication:service"
+        }
       }
     },
     "securitySchemes": {
index 0c0a9748dcf45c7d03efb0400ad817b1b887da82..4dcb64385a06301b646df3854d40b03e64f09bcc 100644 (file)
@@ -23,6 +23,10 @@ module duplication-service {
     uses test-grouping;
   }
 
+  grouping test-grouping3 {
+    uses test-grouping;
+  }
+
   augment "/dt:test-rpc/dt:input" {
     uses test-grouping2;
   }
@@ -30,4 +34,14 @@ module duplication-service {
   augment "/dt:test-rpc2/dt:input" {
     uses test-grouping;
   }
+
+  augment "/dt:test-rpc3/dt:input" {
+    uses test-grouping3;
+  }
+
+  augment "/dt:test-rpc3/dt:input/test-choice/first/first" {
+    leaf input-leaf1 {
+      type string;
+    }
+  }
 }
index 59e3bd629756183ea55e2c7c80e43ec22444c420..b1fcfeb1fb04573cc03bc95abaf3e06b5437bfd5 100644 (file)
@@ -18,4 +18,12 @@ module duplication-test {
       }
     }
   }
+
+  rpc test-rpc3 {
+    input {
+      leaf input-leaf {
+        type string;
+      }
+    }
+  }
 }