summaryrefslogtreecommitdiffstats
path: root/cps-rest
diff options
context:
space:
mode:
authoregernug <gerard.nugent@est.tech>2023-06-21 11:16:02 +0100
committerToine Siebelink <toine.siebelink@est.tech>2023-06-26 09:01:29 +0000
commit9426ae8762a86bda07d99b807718ab2590642b25 (patch)
tree73c5a82a705e2105c221f652e351c9cb66be2767 /cps-rest
parent0aec08e870c767e345db5c2ac2dc8550dea88cb5 (diff)
Chsnge to OpenApi 3.0
In preparation for the Java 17 and Springboot 3 migrations Swagger Codegen has to upgrade to OpenApi 3.0 This effects cps-rest and cps-ncmp-rest Issue-Id: CPS-1745 Signed-off-by: egernug <gerard.nugent@est.tech> Change-Id: I18b8e9ca26d0123009702c2474efbfbeec6d4c44
Diffstat (limited to 'cps-rest')
-rw-r--r--cps-rest/docs/openapi/openapi.yml4
-rwxr-xr-xcps-rest/pom.xml9
-rwxr-xr-xcps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java18
-rwxr-xr-xcps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java16
4 files changed, 27 insertions, 20 deletions
diff --git a/cps-rest/docs/openapi/openapi.yml b/cps-rest/docs/openapi/openapi.yml
index d5ba97aeb3..4bbf9f0fb6 100644
--- a/cps-rest/docs/openapi/openapi.yml
+++ b/cps-rest/docs/openapi/openapi.yml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation
+# Copyright (C) 2021-2023 Nordix Foundation
# Modifications Copyright (C) 2021 Pantheon.tech
# Modifications Copyright (C) 2021 Bell Canada.
# Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
@@ -19,7 +19,7 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-openapi: 3.0.1
+openapi: 3.0.3
info:
title: ONAP Open API v3 Configuration Persistence Service
description: Configuration Persistence Service is a Model Driven Generic Database
diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml
index f6f81006ed..c581b061dc 100755
--- a/cps-rest/pom.xml
+++ b/cps-rest/pom.xml
@@ -128,8 +128,9 @@
<plugins>
<!-- Swagger code generation. -->
<plugin>
- <groupId>io.swagger.codegen.v3</groupId>
- <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <groupId>org.openapitools</groupId>
+ <artifactId>openapi-generator-maven-plugin</artifactId>
+ <version>6.6.0</version>
<executions>
<execution>
<id>code-gen</id>
@@ -141,13 +142,15 @@
<invokerPackage>org.onap.cps.rest.controller</invokerPackage>
<modelPackage>org.onap.cps.rest.model</modelPackage>
<apiPackage>org.onap.cps.rest.api</apiPackage>
- <language>spring</language>
+ <generatorName>spring</generatorName>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<sourceFolder>src/gen/java</sourceFolder>
<dateLibrary>java11</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<useTags>true</useTags>
+ <openApiNullable>false</openApiNullable>
+ <skipDefaultInterface>true</skipDefaultInterface>
</configOptions>
</configuration>
</execution>
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 993c5a3b52..369c94d294 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
@@ -96,14 +96,15 @@ public class AdminRestController implements CpsAdminApi {
/**
* Create a {@link SchemaSet}.
*
- * @param multipartFile multipart file
- * @param schemaSetName schemaset name
* @param dataspaceName dataspace name
+ * @param schemaSetName schemaset name
+ * @param multipartFile multipart file
* @return a {@Link ResponseEntity} of created schemaset name & {@link HttpStatus} CREATED
*/
@Override
- public ResponseEntity<String> createSchemaSet(@NotNull @Valid final String schemaSetName,
- final String dataspaceName, @Valid final MultipartFile multipartFile) {
+ public ResponseEntity<String> createSchemaSet(final String dataspaceName,
+ @NotNull @Valid final String schemaSetName,
+ final MultipartFile multipartFile) {
cpsModuleService.createSchemaSet(dataspaceName, schemaSetName, extractYangResourcesMap(multipartFile));
return new ResponseEntity<>(schemaSetName, HttpStatus.CREATED);
}
@@ -111,16 +112,17 @@ public class AdminRestController implements CpsAdminApi {
/**
* Create a {@link SchemaSet}.
*
- * @param multipartFile multipart file
- * @param schemaSetName schemaset name
* @param dataspaceName dataspace name
+ * @param schemaSetName schemaset name
+ * @param multipartFile multipart file
* @return a {@Link ResponseEntity} of created schema set without any response body & {@link HttpStatus} CREATED
*/
@Override
@Timed(value = "cps.rest.admin.controller.schemaset.create",
description = "Time taken to create schemaset from controller")
- public ResponseEntity<Void> createSchemaSetV2(@NotNull @Valid final String schemaSetName,
- final String dataspaceName, @Valid final MultipartFile multipartFile) {
+ public ResponseEntity<Void> createSchemaSetV2(final String dataspaceName,
+ @NotNull @Valid final String schemaSetName,
+ final MultipartFile multipartFile) {
cpsModuleService.createSchemaSet(dataspaceName, schemaSetName, extractYangResourcesMap(multipartFile));
return new ResponseEntity<>(HttpStatus.CREATED);
}
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 edfeab33ec..62163327ff 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2022 Bell Canada.
* Modifications Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2021-2022 Nordix Foundation
+ * Modifications Copyright (C) 2021-2023 Nordix Foundation
* Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
* Modifications Copyright (C) 2022 Deutsche Telekom AG
* ================================================================================
@@ -63,9 +63,9 @@ public class DataRestController implements CpsDataApi {
private final PrefixResolver prefixResolver;
@Override
- public ResponseEntity<String> createNode(@RequestHeader(value = "Content-Type") final String contentTypeHeader,
- final String apiVersion,
+ public ResponseEntity<String> createNode(final String apiVersion,
final String dataspaceName, final String anchorName,
+ @RequestHeader(value = "Content-Type") final String contentTypeHeader,
final String nodeData, final String parentNodeXpath,
final String observedTimestamp) {
final ContentType contentType = contentTypeHeader.contains(MediaType.APPLICATION_XML_VALUE) ? ContentType.XML
@@ -90,8 +90,9 @@ public class DataRestController implements CpsDataApi {
}
@Override
- public ResponseEntity<String> addListElements(final String parentNodeXpath, final String apiVersion,
- final String dataspaceName, final String anchorName, final Object jsonData, final String observedTimestamp) {
+ public ResponseEntity<String> addListElements(final String apiVersion, final String dataspaceName,
+ final String anchorName, final String parentNodeXpath,
+ final Object jsonData, final String observedTimestamp) {
cpsDataService.saveListElements(dataspaceName, anchorName, parentNodeXpath,
jsonObjectMapper.asJsonString(jsonData), toOffsetDateTime(observedTimestamp));
return new ResponseEntity<>(HttpStatus.CREATED);
@@ -148,8 +149,9 @@ public class DataRestController implements CpsDataApi {
}
@Override
- public ResponseEntity<Object> replaceListContent(final String parentNodeXpath,
- final String apiVersion, final String dataspaceName, final String anchorName, final Object jsonData,
+ public ResponseEntity<Object> replaceListContent(final String apiVersion,
+ final String dataspaceName, final String anchorName,
+ final String parentNodeXpath, final Object jsonData,
final String observedTimestamp) {
cpsDataService.replaceListContent(dataspaceName, anchorName, parentNodeXpath,
jsonObjectMapper.asJsonString(jsonData), toOffsetDateTime(observedTimestamp));