From 39ef5b3c5e074bb5d1b13286b1415baa40b3f27d Mon Sep 17 00:00:00 2001
From: Fabian Helm <fabian.helm@stud.h-da.de>
Date: Wed, 15 Dec 2021 01:51:45 +0100
Subject: [PATCH] introduced parameters, removed / path

---
 openapi-gosdn.yml | 80 +++++++++++++++++++++++++++--------------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/openapi-gosdn.yml b/openapi-gosdn.yml
index ff64068a5..99e090fc7 100644
--- a/openapi-gosdn.yml
+++ b/openapi-gosdn.yml
@@ -6,22 +6,6 @@ info:
 servers:
   - url: http://localhost:8080/api
 paths:
-  /:
-    summary: Represents a list of all PNDs, SBIs and ONDs in the Network
-    get:
-      summary: Returns a list of all PNDs, SBIs and ONDs
-      description: Returns a list of Principal Network Domains (PNDs), South Bound Interfaces (SBIs) and Orchestrated Network Devices (ONDs) in the network
-      responses:
-        '200':
-          description: Successfully returned a list of UUIDs of PNDs, SBIs and ONDs.
-          content:
-            application/json:
-              schema:
-                  type: array
-                  items:
-                    $ref: '#/components/schemas/list_entity_all'
-        '204':
-          description: No entities registered with controller.
   /pnds:
     summary: Represents a list of all PNDs in the Network
     get:
@@ -54,11 +38,13 @@ paths:
               schema:
                 type: string
                 format: uuid
-  /pnds/{uuid}:
+  /pnds/{pndUuid}:
     summary: Represents a PND
     description: >
       This resource represents an individual Principal Network Domain in the network.
       Each PND is identified by a `uuid` string.
+    parameters:
+        - $ref: '#/components/parameters/pndUuidParam'
     get:
       summary: Views an existing PND
       responses:
@@ -84,8 +70,10 @@ paths:
       responses:
         '200':
           description: Successfully deleted PND. 
-  /pnds/{uuid}/devices:
+  /pnds/{pndUuid}/devices:
     summary: Represents a list of all devices in current PND
+    parameters:
+        - $ref: '#/components/parameters/pndUuidParam'
     get: 
       summary: Returns a list of all devices within PND
       description: Return a list of all orchestrated network devices within the current PND
@@ -116,11 +104,14 @@ paths:
               schema:
                 type: string
                 format: uuid
-  /pnds/{uuid}/devices/{uuid}:
+  /pnds/{pndUuid}/devices/{deviceUuid}:
     summary: Represents a device
     description: >
       This resource represents an individual device within a PND in the network.
       Each PND is identified by a `uuid` string.
+    parameters:
+      - $ref: '#/components/parameters/pndUuidParam'
+      - $ref: '#/components/parameters/deviceUuidParam'
     get:
       summary: Views an existing device
       responses:
@@ -151,6 +142,9 @@ paths:
     description: >
       This resource represents the configuration of an individual device within a PND in the network.
       Each PND is identified by a `uuid` string. The configuration can be retrieved and modified with a string.
+    parameters:
+      - $ref: '#/components/parameters/pndUuidParam'
+      - $ref: '#/components/parameters/deviceUuidParam'
     get:
       summary: Retrieves the config of an existing device matching given string
       requestBody: 
@@ -195,23 +189,54 @@ paths:
                   example: ["123e4567-e89b-12d3-a456-426614174000", "62409cf9-3ae2-4bc9-bb1b-31477e908d34"]
         '204':
           description: No changes pending.
-  /changes/commit/{uuid}:
+  /changes/commit/{changeUuid}:
     summary: Commit change made to individual PND
+    parameters:
+      - $ref: '#/components/parameters/changeUuidParam'
     put:
+      summary: Commits a change
       responses:
         '200':
           description: Successfully commited change of PND.
         '204':
           description: No changes to commit on PND.
-  /changes/confirm/{uuid}:
+  /changes/confirm/{changeUuid}:
     summary: Confirm change made to individual PND
+    parameters:
+      - $ref: '#/components/parameters/changeUuidParam'
     put: 
+      summary: Confirms a change
       responses:
         '200':
           description: Successfully confirmed change of PND.
         '204':
           description: No changes to confirm on PND.
 components:
+  parameters:
+    pndUuidParam:
+      in: path
+      name: pndUuid
+      required: true
+      schema:
+        type: string
+        format: uuid
+      description: The pnd UUID
+    deviceUuidParam:
+      in: path
+      name: deviceUuid
+      required: true
+      schema:
+        type: string
+        format: uuid
+      description: The device UUID
+    changeUuidParam:
+      in: path
+      name: changeUuid
+      required: true
+      schema:
+        type: string
+        format: uuid
+      description: The change UUID
   schemas:
     pnd:
       properties:
@@ -264,17 +289,4 @@ components:
             type: string
         name:
             type: string
-    kind_enum:
-      properties:
-        kind:
-          type: string
-          enum:
-            - pnd
-            - device
-            - sbi
-    list_entity_all:
-      allOf:
-        - $ref: '#/components/schemas/list_entity'
-        - type: object
-          $ref: '#/components/schemas/kind_enum'
     
-- 
GitLab