summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cps/README.md5
-rw-r--r--cps/cps-dependencies/pom.xml16
-rw-r--r--cps/cps-parent/pom.xml82
-rw-r--r--cps/cps-rest/pom.xml26
-rw-r--r--cps/cps-rest/src/main/java/org/onap/cps/swagger/config/SpringFoxConfig.java46
-rw-r--r--cps/cps-rest/src/main/resources/application.yml8
6 files changed, 56 insertions, 127 deletions
diff --git a/cps/README.md b/cps/README.md
index d1bf49d8cf..d5f0c66f4c 100644
--- a/cps/README.md
+++ b/cps/README.md
@@ -29,6 +29,5 @@ java -DDB_HOST=localhost -DDB_USERNAME=cps -DDB_PASSWORD=cps -jar cps-rest/targe
```
* Browse
- * [Swagger UI](http://localhost:8080/swagger-ui/index.html)
- * OpenAPI Specification in [JSON](http://localhost:8080/api/cps/openapi.json)
- or [YAML](http://localhost:8080/api/cps/openapi.yaml) format
+ * [Swagger UI](http://localhost:8080/api/cps/swagger-ui/index.html)
+ * [Api Documentation](http://localhost:8080/api/cps/v3/api-docs)
diff --git a/cps/cps-dependencies/pom.xml b/cps/cps-dependencies/pom.xml
index ad71b11583..ee37b1e0a2 100644
--- a/cps/cps-dependencies/pom.xml
+++ b/cps/cps-dependencies/pom.xml
@@ -17,7 +17,7 @@
<hibernate-types.version>2.10.0</hibernate-types.version>
<spock-core.version>2.0-M2-groovy-3.0</spock-core.version>
<springboot.version>2.3.3.RELEASE</springboot.version>
- <springfox-swagger2.version>2.6.1</springfox-swagger2.version>
+ <springfox.version>3.0.0</springfox.version>
<swagger.version>2.1.4</swagger.version>
<yangtools.version>5.0.6</yangtools.version>
</properties>
@@ -44,19 +44,9 @@
<version>${swagger.version}</version>
</dependency>
<dependency>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-jaxrs2</artifactId>
- <version>${swagger.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>${springfox-swagger2.version}</version>
- </dependency>
- <dependency>
<groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox-swagger2.version}</version>
+ <artifactId>springfox-boot-starter</artifactId>
+ <version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
diff --git a/cps/cps-parent/pom.xml b/cps/cps-parent/pom.xml
index db80970c53..04f423caa2 100644
--- a/cps/cps-parent/pom.xml
+++ b/cps/cps-parent/pom.xml
@@ -17,13 +17,9 @@
<properties>
<java.version>11</java.version>
- <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
- <maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
- <maven-replacer-plugin.version>1.5.3</maven-replacer-plugin.version>
<oparent.version>3.1.0</oparent.version>
<spring-boot-maven-plugin.version>2.3.3.RELEASE</spring-boot-maven-plugin.version>
<swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
- <swagger-ui.version>3.35.0</swagger-ui.version>
</properties>
<dependencyManagement>
@@ -106,84 +102,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <!-- Download Swagger UI webjar. -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>${maven-dependency-plugin.version}</version>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.webjars</groupId>
- <artifactId>swagger-ui</artifactId>
- <version>${swagger-ui.version}</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>
- ${project.build.directory}/swagger-ui-${swagger-ui.version}
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- Copy Swagger UI resources to static resources directory. -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>${maven-resources-plugin.version}</version>
- <executions>
- <execution>
- <id>copy-resources</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.outputDirectory}/static/swagger-ui
- </outputDirectory>
- <resources>
- <resource>
- <directory>
- ${project.build.directory}/swagger-ui-${swagger-ui.version}/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/
- </directory>
- <excludes>
- <exclude>**/*.gz</exclude>
- </excludes>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- Replace the OpenAPI specification example URL with the local one. -->
- <groupId>com.google.code.maven-replacer-plugin</groupId>
- <artifactId>replacer</artifactId>
- <version>${maven-replacer-plugin.version}</version>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <goals>
- <goal>replace</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <file>${project.build.outputDirectory}/static/swagger-ui/index.html</file>
- <replacements>
- <replacement>
- <token>https://petstore.swagger.io/v2/swagger.json</token>
- <value>/api/cps/openapi.json</value>
- </replacement>
- </replacements>
- </configuration>
- </plugin>
</plugins>
</pluginManagement>
<plugins>
diff --git a/cps/cps-rest/pom.xml b/cps/cps-rest/pom.xml
index fcd97dcf77..d10e0b63ba 100644
--- a/cps/cps-rest/pom.xml
+++ b/cps/cps-rest/pom.xml
@@ -39,17 +39,10 @@
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-jaxrs2</artifactId>
- </dependency>
- <dependency>
<groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
+ <artifactId>springfox-boot-starter</artifactId>
</dependency>
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@@ -74,21 +67,6 @@
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
</plugin>
- <plugin>
- <!-- Download Swagger UI webjar. -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- <plugin>
- <!-- Copy Swagger UI resources to static resources directory. -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- </plugin>
- <plugin>
- <!-- Replace the OpenAPI specification example URL with the local one. -->
- <groupId>com.google.code.maven-replacer-plugin</groupId>
- <artifactId>replacer</artifactId>
- </plugin>
</plugins>
</build>
</project>
diff --git a/cps/cps-rest/src/main/java/org/onap/cps/swagger/config/SpringFoxConfig.java b/cps/cps-rest/src/main/java/org/onap/cps/swagger/config/SpringFoxConfig.java
new file mode 100644
index 0000000000..73e179511b
--- /dev/null
+++ b/cps/cps-rest/src/main/java/org/onap/cps/swagger/config/SpringFoxConfig.java
@@ -0,0 +1,46 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Bell Canada. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.onap.cps.swagger.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+
+/**
+ * Swagger configuration.
+ */
+@Configuration
+public class SpringFoxConfig {
+
+ /**
+ * Define api configuration.
+ */
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.OAS_30)
+ .select()
+ .apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any())
+ .build();
+ }
+}
diff --git a/cps/cps-rest/src/main/resources/application.yml b/cps/cps-rest/src/main/resources/application.yml
index 8e2aee043c..545faafc37 100644
--- a/cps/cps-rest/src/main/resources/application.yml
+++ b/cps/cps-rest/src/main/resources/application.yml
@@ -1,7 +1,7 @@
server:
- port: 8080
- servlet:
- context-path: /api/cps
+ port: 8080
+ servlet:
+ context-path: /api/cps
spring:
main:
@@ -21,8 +21,6 @@ spring:
password: ${DB_PASSWORD}
driverClassName: org.postgresql.Driver
initialization-mode: always
- jersey:
- type: filter
logging:
level: