Split OpenAPI yaml file

1. components like schema, parameters, responses, requestBodies all moved to components.yml (https://swagger.io/docs/specification/components/)
2. CpAdmin.yml includes the configuration details for cpsAdmin APIs
3. CpsData.yml includes the API configuration details for cpsData

Issue-ID: CPS-155
Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca>
Change-Id: I18fb9b8a2be85d180d4625657aca399dbf60b7bc
diff --git a/cps-rest/docs/api/swagger/openapi.yml b/cps-rest/docs/api/swagger/openapi.yml
index 2acd2b1..44064e2 100755
--- a/cps-rest/docs/api/swagger/openapi.yml
+++ b/cps-rest/docs/api/swagger/openapi.yml
@@ -10,400 +10,25 @@
     description: cps Resource
 paths:
   /v1/dataspaces:
-    post:
-      tags:
-        - cps-admin
-      summary: Create a new dataspace
-      operationId: createDataspace
-      parameters:
-        - name: dataspace-name
-          in: query
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-      responses:
-        201:
-          description: Created
-          content:
-            application/json:
-              schema:
-                type: string
-        400:
-          description: Bad Request
-          content: { }
-        401:
-          description: Unauthorized
-          content: { }
-        403:
-          description: Forbidden
-          content: { }
+    $ref: 'cpsAdmin.yml#/dataspace'
+
   /v1/dataspaces/{dataspace-name}/:
-    delete:
-      tags:
-        - cps-admin
-      summary: Delete the given dataspace
-      operationId: deleteDataspace
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        204:
-          description: No Content
-          content: {}
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
-  /v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}:
-    get:
-      tags:
-        - cps-admin
-      summary: Read a schema set given a schema set and a dataspace
-      operationId: getSchemaSet
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-        - name: schema-set-name
-          in: path
-          description: schema-name
-          required: true
-          schema:
-            type: string
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
-        404:
-          description: Not Found
-          content: {}
-  /v1/dataspaces/{dataspace-name}/schema-sets:
-    post:
-      tags:
-        - cps-admin
-      summary: Create a new schema set in the given dataspace
-      operationId: createSchemaSet
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-      requestBody:
-        required: true
-        content:
-          multipart/form-data:
-            schema:
-              required:
-                - schemaSetName
-                - multipartFile
-              properties:
-                schemaSetName:
-                  type: string
-                multipartFile:
-                  type: string
-                  description: multipartFile
-                  format: binary
-      responses:
-        201:
-          description: Created
-          content:
-            application/json:
-              schema:
-                type: string
-        401:
-          description: Unauthorized
-          content: { }
-        403:
-          description: Forbidden
-          content: { }
+    $ref: 'cpsAdmin.yml#/dataspaceByDataspaceName'
+
   /v1/dataspaces/{dataspace-name}/anchors:
-    get:
-      tags:
-        - cps-admin
-      summary: Read all anchors, given a dataspace
-      operationId: getAnchors
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        401:
-          description: Unauthorized
-          content: {}
-        400:
-          description: Bad Request
-          content: {}
-        403:
-          description: Forbidden
-        404:
-          description: Not Found
-          content: {}
-        204:
-          description: No Content
-          content: {}
-    post:
-      tags:
-        - cps-admin
-      summary: Create a new anchor in the given dataspace
-      operationId: createAnchor
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-        - name: schema-set-name
-          in: query
-          description: schema-set-name
-          required: true
-          schema:
-            type: string
-        - name: anchor-name
-          in: query
-          description: anchor-name
-          required: true
-          schema:
-            type: string
-      responses:
-        201:
-          description: Created
-          content:
-            application/json:
-              schema:
-                type: string
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
-        404:
-          description: Not Found
-          content: {}
+    $ref: 'cpsAdmin.yml#/anchorsByDataspace'
+
   /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}:
-    get:
-      tags:
-        - cps-admin
-      summary: Read an anchor given a anchor and a dataspace
-      operationId: getAnchor
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-        - name: anchor-name
-          in: path
-          description: anchor-name
-          required: true
-          schema:
-            type: string
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
-        404:
-          description: Not Found
-          content: {}
-    delete:
-      tags:
-        - cps-admin
-      summary: Delete an anchor given a anchor and a dataspace
-      operationId: deleteAnchor
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-        - name: anchor-name
-          in: path
-          description: anchor-name
-          required: true
-          schema:
-            type: string
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        204:
-          description: No Content
-          content: {}
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
+    $ref: 'cpsAdmin.yml#/anchorByDataspaceAndAnchorName'
+
+  /v1/dataspaces/{dataspace-name}/schema-sets:
+    $ref: 'cpsAdmin.yml#/schemaSet'
+
+  /v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}:
+    $ref: 'cpsAdmin.yml#/schemaSetBySchemaSetName'
+
   /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes:
-    get:
-      tags:
-        - cps-data
-      summary: Get a node given an anchor for the given dataspace
-      operationId: getNodeByDataspaceAndAnchor
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-        - name: anchor-name
-          in: path
-          description: anchor-name
-          required: true
-          schema:
-            type: string
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
-        404:
-          description: Not Found
-          content: {}
-      x-codegen-request-body-name: xpath
+    $ref: 'cpsData.yml#/nodesByDataspaceAndAnchor'
+
   /v1/dataspaces/{dataspace-name}/nodes:
-    get:
-      tags:
-        - cps-data
-      summary: Get all nodes for a given dataspace using an xpath or schema node identifier
-      operationId: getNode
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
-        404:
-          description: Not Found
-          content: {}
-      x-codegen-request-body-name: requestBody
-    post:
-      tags:
-        - cps-data
-      summary: Create a node for a given anchor for the given dataspace
-      operationId: createNode
-      parameters:
-        - name: dataspace-name
-          in: path
-          description: dataspace-name
-          required: true
-          schema:
-            type: string
-      requestBody:
-        content:
-          multipart/form-data:
-            schema:
-              required:
-                - file
-              properties:
-                multipartFile:
-                  type: string
-                  description: multipartFile
-                  format: binary
-        required: true
-      responses:
-        200:
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: object
-        201:
-          description: Created
-          content: {}
-        401:
-          description: Unauthorized
-          content: {}
-        403:
-          description: Forbidden
-          content: {}
-        404:
-          description: Not Found
-          content: {}
-components:
-  schemas:
-    ErrorMessage:
-      type: object
-      title: Error
-      properties:
-        status:
-          type: string
-        message:
-          type: string
-        details:
-          type: string
+    $ref: 'cpsData.yml#/nodesByDataspace'