diff options
Diffstat (limited to 'cps-rest')
-rw-r--r-- | cps-rest/docs/openapi/components.yml (renamed from cps-rest/src/main/resources/static/components.yml) | 5 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsAdmin.yml (renamed from cps-rest/src/main/resources/static/cpsAdmin.yml) | 24 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsData.yml (renamed from cps-rest/src/main/resources/static/cpsData.yml) | 27 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsQuery.yml (renamed from cps-rest/src/main/resources/static/cpsQuery.yml) | 0 | ||||
-rw-r--r-- | cps-rest/docs/openapi/openapi.yml (renamed from cps-rest/src/main/resources/static/openapi.yml) | 9 | ||||
-rwxr-xr-x | cps-rest/pom.xml | 32 | ||||
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/config/CpsConfig.java | 16 | ||||
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java | 13 | ||||
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java | 5 | ||||
-rw-r--r-- | cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy | 7 |
10 files changed, 40 insertions, 98 deletions
diff --git a/cps-rest/src/main/resources/static/components.yml b/cps-rest/docs/openapi/components.yml index 75a6f99fc9..3d2eb57e4d 100644 --- a/cps-rest/src/main/resources/static/components.yml +++ b/cps-rest/docs/openapi/components.yml @@ -12,6 +12,8 @@ # 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========================================================= components: @@ -46,10 +48,11 @@ components: example: Dataspace with name D1 does not exist. MultipartFile: + type: object required: - file properties: - multipartFile: + file: type: string description: multipartFile format: binary diff --git a/cps-rest/src/main/resources/static/cpsAdmin.yml b/cps-rest/docs/openapi/cpsAdmin.yml index 35b2e4ca6a..a022ef1d94 100644 --- a/cps-rest/src/main/resources/static/cpsAdmin.yml +++ b/cps-rest/docs/openapi/cpsAdmin.yml @@ -12,6 +12,8 @@ # 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: @@ -33,28 +35,6 @@ dataspaces: '403': $ref: 'components.yml#/components/responses/Forbidden' -dataspaceByDataspaceName: - delete: - description: Delete the given dataspace - DRAFT - tags: - - cps-admin - summary: Delete a dataspace - operationId: deleteDataspace - parameters: - - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' - responses: - '200': - $ref: 'components.yml#/components/responses/Ok' - '204': - $ref: 'components.yml#/components/responses/NoContent' - '400': - $ref: 'components.yml#/components/responses/BadRequest' - '401': - $ref: 'components.yml#/components/responses/Unauthorized' - '403': - $ref: 'components.yml#/components/responses/Forbidden' - - schemaSet: post: description: Create a new schema set in the given dataspace diff --git a/cps-rest/src/main/resources/static/cpsData.yml b/cps-rest/docs/openapi/cpsData.yml index 77673cb0f8..d456f44e6c 100644 --- a/cps-rest/src/main/resources/static/cpsData.yml +++ b/cps-rest/docs/openapi/cpsData.yml @@ -12,6 +12,8 @@ # 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========================================================= nodeByDataspaceAndAnchor: @@ -200,27 +202,4 @@ nodesByDataspaceAndAnchor: '401': $ref: 'components.yml#/components/responses/Unauthorized' '403': - $ref: 'components.yml#/components/responses/Forbidden' - - -nodesByDataspace: - get: - description: Get all nodes for a given dataspace using an xpath or schema node identifier - DRAFT - tags: - - cps-data - summary: Get nodes - operationId: getNodesByDataspace - parameters: - - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' - responses: - '200': - $ref: 'components.yml#/components/responses/Ok' - '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' - x-codegen-request-body-name: requestBody + $ref: 'components.yml#/components/responses/Forbidden'
\ No newline at end of file diff --git a/cps-rest/src/main/resources/static/cpsQuery.yml b/cps-rest/docs/openapi/cpsQuery.yml index f45f3f41ae..f45f3f41ae 100644 --- a/cps-rest/src/main/resources/static/cpsQuery.yml +++ b/cps-rest/docs/openapi/cpsQuery.yml diff --git a/cps-rest/src/main/resources/static/openapi.yml b/cps-rest/docs/openapi/openapi.yml index 922cabb01e..f9881fb151 100644 --- a/cps-rest/src/main/resources/static/openapi.yml +++ b/cps-rest/docs/openapi/openapi.yml @@ -1,6 +1,7 @@ # ============LICENSE_START======================================================= # Copyright (C) 2021 Nordix Foundation # Modifications Copyright (C) 2021 Pantheon.tech +# Modifications Copyright (C) 2021 Bell Canada. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,15 +41,12 @@ tags: - name: cps-admin description: cps Admin - name: cps-data - description: cps Data + description: cps Data paths: /v1/dataspaces: $ref: 'cpsAdmin.yml#/dataspaces' - /v1/dataspaces/{dataspace-name}: - $ref: 'cpsAdmin.yml#/dataspaceByDataspaceName' - /v1/dataspaces/{dataspace-name}/anchors: $ref: 'cpsAdmin.yml#/anchorsByDataspace' @@ -70,8 +68,5 @@ paths: /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes: $ref: 'cpsData.yml#/listNodeByDataspaceAndAnchor' - /v1/dataspaces/{dataspace-name}/nodes: - $ref: 'cpsData.yml#/nodesByDataspace' - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query: $ref: 'cpsQuery.yml#/nodesByDataspaceAndAnchorAndCpsPath' diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml index 9e29074f76..c4af3803b5 100755 --- a/cps-rest/pom.xml +++ b/cps-rest/pom.xml @@ -15,6 +15,8 @@ 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========================================================= --> @@ -67,10 +69,6 @@ <artifactId>swagger-annotations</artifactId> </dependency> <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-boot-starter</artifactId> - </dependency> - <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>1.5.9</version> @@ -130,11 +128,12 @@ <artifactId>swagger-codegen-maven-plugin</artifactId> <executions> <execution> + <id>code-gen</id> <goals> <goal>generate</goal> </goals> <configuration> - <inputSpec>${project.basedir}/src/main/resources/static/openapi.yml</inputSpec> + <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec> <invokerPackage>org.onap.cps.rest.controller</invokerPackage> <modelPackage>org.onap.cps.rest.model</modelPackage> <apiPackage>org.onap.cps.rest.api</apiPackage> @@ -150,6 +149,29 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-resources</id> + <phase>compile</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.basedir}/target/classes/static/api-docs/cps-core</outputDirectory> + <resources> + <resource> + <directory>${project.basedir}/target/generated-sources/swagger/</directory> + <includes> + <include>openapi.yaml</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </project> diff --git a/cps-rest/src/main/java/org/onap/cps/config/CpsConfig.java b/cps-rest/src/main/java/org/onap/cps/config/CpsConfig.java index 5793d9536c..4f4501afb2 100755 --- a/cps-rest/src/main/java/org/onap/cps/config/CpsConfig.java +++ b/cps-rest/src/main/java/org/onap/cps/config/CpsConfig.java @@ -26,28 +26,12 @@ import org.modelmapper.ModelMapper; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.retry.annotation.EnableRetry;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
@Configuration
@EnableRetry
public class CpsConfig {
/**
- * Swagger configuration.
- */
- @Bean("cps-docket")
- public Docket api() {
- return new Docket(DocumentationType.OAS_30)
- .groupName("cps-docket")
- .select()
- .apis(RequestHandlerSelectors.any())
- .paths(PathSelectors.any()).build();
- }
-
- /**
* ModelMapper configuration.
*/
@Bean
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java index a1287b2bd6..55fdbbe87a 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation - * Modifications Copyright (C) 2020 Bell Canada. + * Modifications Copyright (C) 2020-2021 Bell Canada. * Modifications Copyright (C) 2021 Pantheon.tech * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,17 +71,6 @@ public class AdminRestController implements CpsAdminApi { } /** - * Delete a dataspace based on a given name. - * - * @param dataspaceName dataspace name - * @return a {@Link ResponseEntity} of {@link HttpStatus} NOT_IMPLEMENTED - */ - @Override - public ResponseEntity<Object> deleteDataspace(final String dataspaceName) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - } - - /** * Create a {@link SchemaSet}. * * @param multipartFile multipart file diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java index 0e2050e5cc..7db4e5a1b6 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java @@ -68,11 +68,6 @@ public class DataRestController implements CpsDataApi { } @Override - public ResponseEntity<Object> getNodesByDataspace(final String dataspaceName) { - return null; - } - - @Override public ResponseEntity<Object> getNodeByDataspaceAndAnchor(final String dataspaceName, final String anchorName, final String xpath, final Boolean includeDescendants) { final FetchDescendantsOption fetchDescendantsOption = Boolean.TRUE.equals(includeDescendants) diff --git a/cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy index 6c589b1bb4..fc96f04471 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Nordix Foundation + * Modifications Copyright (C) 2021 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +23,6 @@ package org.onap.cps.config import org.modelmapper.ModelMapper import spock.lang.Specification -import springfox.documentation.spring.web.plugins.Docket class CpsConfigSpec extends Specification { def objectUnderTest = new CpsConfig() @@ -31,9 +31,4 @@ class CpsConfigSpec extends Specification { expect: 'the CPS configuration has a Model Mapper' objectUnderTest.modelMapper() instanceof ModelMapper } - - def 'CPS configuration has a Docket API'() { - expect: 'the CPS configuration has a Docket API' - objectUnderTest.api() instanceof Docket - } } |