CPS-401 Update Open API YAML with data types and example for output (cpsData) 29/122129/3
authorJosephKeenan <joseph.keenan@est.tech>
Wed, 23 Jun 2021 13:15:52 +0000 (14:15 +0100)
committerJosephKeenan <joseph.keenan@est.tech>
Fri, 16 Jul 2021 13:58:31 +0000 (14:58 +0100)
-added response for get data nodes based on dataspace and anchor
-modified modelmapper jn DataRestControllerSpec to be Spy not Mock
-when openapi.yaml is entered into https://editor.swagger.io/ it
displays however locally it does not, This may be due to file
segmentation but this is still unclear.
-moved files from docs/openapi to src/main/resources/static as required
for new swagger sprindoc

Issue-ID: CPS-401

Change-Id: I45286530d9a9ca85b56c0a656a44675398a003f4
Signed-off-by: JosephKeenan <joseph.keenan@est.tech>
cps-application/src/main/resources/application.yml
cps-rest/pom.xml
cps-rest/src/main/resources/static/components.yml [moved from cps-rest/docs/openapi/components.yml with 99% similarity]
cps-rest/src/main/resources/static/cpsAdmin.yml [moved from cps-rest/docs/openapi/cpsAdmin.yml with 100% similarity]
cps-rest/src/main/resources/static/cpsData.yml [moved from cps-rest/docs/openapi/cpsData.yml with 96% similarity]
cps-rest/src/main/resources/static/cpsQuery.yml [moved from cps-rest/docs/openapi/cpsQuery.yml with 100% similarity]
cps-rest/src/main/resources/static/openapi.yml [moved from cps-rest/docs/openapi/openapi.yml with 99% similarity]

index 1b62b02..ac620f6 100644 (file)
@@ -73,6 +73,11 @@ notification:
         enabled: false\r
         topic: ${CPS_CHANGE_EVENT_TOPIC:cps.cfg-state-events}\r
 \r
+springdoc:\r
+    swagger-ui:\r
+        url: /openapi.yml\r
+        path: /swagger-ui/index.html\r
+        \r
 security:\r
     # comma-separated uri patterns which do not require authorization\r
     permit-uri: /manage/**,/swagger-ui/**,/swagger-resources/**,/v3/api-docs\r
index 4b42656..9a13117 100755 (executable)
             <groupId>io.swagger</groupId>
             <artifactId>swagger-annotations</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springdoc</groupId>
+            <artifactId>springdoc-openapi-ui</artifactId>
+            <version>1.5.9</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
                             <goal>generate</goal>
                         </goals>
                         <configuration>
-                            <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec>
+                            <inputSpec>${project.basedir}/src/main/resources/static/openapi.yml</inputSpec>
                             <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
                             <modelPackage>org.onap.cps.rest.model</modelPackage>
                             <apiPackage>org.onap.cps.rest.api</apiPackage>
similarity index 99%
rename from cps-rest/docs/openapi/components.yml
rename to cps-rest/src/main/resources/static/components.yml
index 6543fca..51a49a6 100644 (file)
@@ -196,6 +196,7 @@ components:
         application/json:
           schema:
             type: object
+          example: { "key": "value" }
     Created:
       description: Created
       content:
similarity index 96%
rename from cps-rest/docs/openapi/cpsData.yml
rename to cps-rest/src/main/resources/static/cpsData.yml
index fb21f75..7e9f71d 100644 (file)
@@ -28,7 +28,12 @@ nodeByDataspaceAndAnchor:
       - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery'
     responses:
       '200':
-        $ref: 'components.yml#/components/responses/Ok'
+        description: OK
+        content:
+          application/json:
+            schema:
+              type: object
+            example: { "child": my_child,"leafList": "leafListElement1, leafListElement2", "leaf": my_leaf }
       '400':
         $ref: 'components.yml#/components/responses/BadRequest'
       '401':
similarity index 99%
rename from cps-rest/docs/openapi/openapi.yml
rename to cps-rest/src/main/resources/static/openapi.yml
index caaad68..8fa640c 100644 (file)
@@ -35,7 +35,7 @@ info:
       url: "cps_logo.png"
 
 servers:
-  - url: //localhost:8088
+  - url: /cps/api
 tags:
   - name: cps-admin
     description: cps Admin