[TECHDEBT] Align CPS Core REST API Specification and Implementation
[cps.git] / cps-rest / docs / openapi / cpsAdmin.yml
index cf26299..a25f81e 100644 (file)
@@ -1,3 +1,22 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2021 Bell Canada.
+# Modifications Copyright (C) 2021-2022 Nordix Foundation
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
 dataspaces:
   post:
     description: Create a new dataspace
@@ -10,25 +29,23 @@ dataspaces:
     responses:
       '201':
         $ref: 'components.yml#/components/responses/Created'
-      '400':
-        $ref: 'components.yml#/components/responses/BadRequest'
       '401':
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
-
-dataspaceByDataspaceName:
+      '409':
+        $ref: 'components.yml#/components/responses/Conflict'
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
   delete:
-    description: Delete the given dataspace - DRAFT
+    description: Delete a dataspace
     tags:
       - cps-admin
     summary: Delete a dataspace
     operationId: deleteDataspace
     parameters:
-      - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
+      - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery'
     responses:
-      '200':
-        $ref: 'components.yml#/components/responses/Ok'
       '204':
         $ref: 'components.yml#/components/responses/NoContent'
       '400':
@@ -37,7 +54,10 @@ dataspaceByDataspaceName:
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
-
+      '409':
+        $ref: 'components.yml#/components/responses/Conflict'
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
 
 schemaSet:
   post:
@@ -55,7 +75,6 @@ schemaSet:
         multipart/form-data:
           schema:
             $ref: 'components.yml#/components/schemas/MultipartFile'
-
     responses:
       '201':
         $ref: 'components.yml#/components/responses/Created'
@@ -65,6 +84,10 @@ schemaSet:
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
+      '409':
+        $ref: 'components.yml#/components/responses/Conflict'
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
 
 schemaSetBySchemaSetName:
   get:
@@ -78,16 +101,19 @@ schemaSetBySchemaSetName:
       - $ref: 'components.yml#/components/parameters/schemaSetNameInPath'
     responses:
       '200':
-        $ref: 'components.yml#/components/responses/Ok'
+        description: OK
+        content:
+          application/json:
+            schema:
+              $ref: 'components.yml#/components/schemas/SchemaSetDetails'
       '400':
         $ref: 'components.yml#/components/responses/BadRequest'
       '401':
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
-      '404':
-        $ref: 'components.yml#/components/responses/NotFound'
-
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
   delete:
     description: Delete a schema set given a schema set name and a dataspace
     tags:
@@ -108,6 +134,8 @@ schemaSetBySchemaSetName:
         $ref: 'components.yml#/components/responses/Forbidden'
       '409':
         $ref: 'components.yml#/components/responses/Conflict'
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
 
 anchorsByDataspace:
   get:
@@ -120,16 +148,21 @@ anchorsByDataspace:
       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
     responses:
       '200':
-        $ref: 'components.yml#/components/responses/Ok'
+        description: OK
+        content:
+          application/json:
+            schema:
+              type: array
+              items:
+                $ref: 'components.yml#/components/schemas/AnchorDetails'
       '400':
         $ref: 'components.yml#/components/responses/BadRequest'
       '401':
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
-      '404':
-        $ref: 'components.yml#/components/responses/NotFound'
-
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
   post:
     description: Create a new anchor in the given dataspace
     tags:
@@ -149,6 +182,10 @@ anchorsByDataspace:
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
+      '409':
+        $ref: 'components.yml#/components/responses/Conflict'
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
 
 anchorByDataspaceAndAnchorName:
   get:
@@ -162,16 +199,19 @@ anchorByDataspaceAndAnchorName:
       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
     responses:
       '200':
-        $ref: 'components.yml#/components/responses/Ok'
+        description: OK
+        content:
+          application/json:
+            schema:
+              $ref: 'components.yml#/components/schemas/AnchorDetails'
       '400':
         $ref: 'components.yml#/components/responses/BadRequest'
       '401':
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
-      '404':
-        $ref: 'components.yml#/components/responses/NotFound'
-
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
   delete:
     description: Delete an anchor given an anchor name and a dataspace
     tags:
@@ -190,3 +230,5 @@ anchorByDataspaceAndAnchorName:
         $ref: 'components.yml#/components/responses/Unauthorized'
       '403':
         $ref: 'components.yml#/components/responses/Forbidden'
+      '500':
+        $ref: 'components.yml#/components/responses/InternalServerError'
\ No newline at end of file