From 2472e61ecf2f5ebf9c5e3ddcf9c2b66ab0d4219e Mon Sep 17 00:00:00 2001 From: JosephKeenan Date: Wed, 23 Jun 2021 14:15:52 +0100 Subject: [PATCH] CPS-401 Update Open API YAML with data types and example for output (cpsData) -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 --- cps-application/src/main/resources/application.yml | 5 +++++ cps-rest/pom.xml | 7 ++++++- .../{docs/openapi => src/main/resources/static}/components.yml | 1 + cps-rest/{docs/openapi => src/main/resources/static}/cpsAdmin.yml | 0 cps-rest/{docs/openapi => src/main/resources/static}/cpsData.yml | 7 ++++++- cps-rest/{docs/openapi => src/main/resources/static}/cpsQuery.yml | 0 cps-rest/{docs/openapi => src/main/resources/static}/openapi.yml | 2 +- 7 files changed, 19 insertions(+), 3 deletions(-) rename cps-rest/{docs/openapi => src/main/resources/static}/components.yml (99%) rename cps-rest/{docs/openapi => src/main/resources/static}/cpsAdmin.yml (100%) rename cps-rest/{docs/openapi => src/main/resources/static}/cpsData.yml (96%) rename cps-rest/{docs/openapi => src/main/resources/static}/cpsQuery.yml (100%) rename cps-rest/{docs/openapi => src/main/resources/static}/openapi.yml (99%) diff --git a/cps-application/src/main/resources/application.yml b/cps-application/src/main/resources/application.yml index 1b62b02df..ac620f6cb 100644 --- a/cps-application/src/main/resources/application.yml +++ b/cps-application/src/main/resources/application.yml @@ -73,6 +73,11 @@ notification: enabled: false topic: ${CPS_CHANGE_EVENT_TOPIC:cps.cfg-state-events} +springdoc: + swagger-ui: + url: /openapi.yml + path: /swagger-ui/index.html + security: # comma-separated uri patterns which do not require authorization permit-uri: /manage/**,/swagger-ui/**,/swagger-resources/**,/v3/api-docs diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml index 4b42656e8..9a131176d 100755 --- a/cps-rest/pom.xml +++ b/cps-rest/pom.xml @@ -74,6 +74,11 @@ io.swagger swagger-annotations + + org.springdoc + springdoc-openapi-ui + 1.5.9 + org.apache.commons commons-lang3 @@ -133,7 +138,7 @@ generate - ${project.basedir}/docs/openapi/openapi.yml + ${project.basedir}/src/main/resources/static/openapi.yml org.onap.cps.rest.controller org.onap.cps.rest.model org.onap.cps.rest.api diff --git a/cps-rest/docs/openapi/components.yml b/cps-rest/src/main/resources/static/components.yml similarity index 99% rename from cps-rest/docs/openapi/components.yml rename to cps-rest/src/main/resources/static/components.yml index 6543fcab6..51a49a6e9 100644 --- a/cps-rest/docs/openapi/components.yml +++ b/cps-rest/src/main/resources/static/components.yml @@ -196,6 +196,7 @@ components: application/json: schema: type: object + example: { "key": "value" } Created: description: Created content: diff --git a/cps-rest/docs/openapi/cpsAdmin.yml b/cps-rest/src/main/resources/static/cpsAdmin.yml similarity index 100% rename from cps-rest/docs/openapi/cpsAdmin.yml rename to cps-rest/src/main/resources/static/cpsAdmin.yml diff --git a/cps-rest/docs/openapi/cpsData.yml b/cps-rest/src/main/resources/static/cpsData.yml similarity index 96% rename from cps-rest/docs/openapi/cpsData.yml rename to cps-rest/src/main/resources/static/cpsData.yml index fb21f757a..7e9f71d62 100644 --- a/cps-rest/docs/openapi/cpsData.yml +++ b/cps-rest/src/main/resources/static/cpsData.yml @@ -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': diff --git a/cps-rest/docs/openapi/cpsQuery.yml b/cps-rest/src/main/resources/static/cpsQuery.yml similarity index 100% rename from cps-rest/docs/openapi/cpsQuery.yml rename to cps-rest/src/main/resources/static/cpsQuery.yml diff --git a/cps-rest/docs/openapi/openapi.yml b/cps-rest/src/main/resources/static/openapi.yml similarity index 99% rename from cps-rest/docs/openapi/openapi.yml rename to cps-rest/src/main/resources/static/openapi.yml index caaad68b6..8fa640cf9 100644 --- a/cps-rest/docs/openapi/openapi.yml +++ b/cps-rest/src/main/resources/static/openapi.yml @@ -35,7 +35,7 @@ info: url: "cps_logo.png" servers: - - url: //localhost:8088 + - url: /cps/api tags: - name: cps-admin description: cps Admin -- 2.16.6