ProvMns interface generation using remote url 20/140920/8
authormpriyank <priyank.maheshwari@est.tech>
Tue, 20 May 2025 11:48:49 +0000 (12:48 +0100)
committermpriyank <priyank.maheshwari@est.tech>
Wed, 4 Jun 2025 15:26:22 +0000 (16:26 +0100)
- Referring to remote ProvMns spec file from the 3gpp sources
- Generating the interface without keeping a local copy of the spec file
- Excluding the files that are not needed in our ProvMnS implementation
  as those were causing issues while code generation
- Have one Resource interface in org.onap.cps.ncmp.rest.provmns.model
  package that is needed to compile the generated code
- Added exclusion in jacoco plugin for code coverage

Issue-ID: CPS-2817
Change-Id: Ie9801fac52850dbd50f975a9b65d36f818b2b474
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
cps-ncmp-rest/.openapi-generator-ignore-provmns [new file with mode: 0644]
cps-ncmp-rest/pom.xml
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/provmns/model/Resource.java [new file with mode: 0644]
cps-parent/pom.xml

diff --git a/cps-ncmp-rest/.openapi-generator-ignore-provmns b/cps-ncmp-rest/.openapi-generator-ignore-provmns
new file mode 100644 (file)
index 0000000..6c9fb32
--- /dev/null
@@ -0,0 +1,17 @@
+# Ignore generation of all the models for ProvMns
+target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/*.java
+
+# Allow generation of the below model for ProvMns
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ClassNameIdGetDataNodeSelectorParameter.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ClassNameIdPatchDefaultResponse.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ErrorResponseDefault.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ErrorResponseDefaultOtherProblemsInner.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ErrorResponseGet.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ErrorResponseGetOtherProblemsInner.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ErrorResponsePatch.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ErrorResponsePatchOtherProblemsInner.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/PatchItem.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/PatchOperation.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ResourceOneOf.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/Scope.java
+!target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/rest/provmns/model/ScopeType.java
\ No newline at end of file
index a5c0c4c..fbef34f 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
   ============LICENSE_START=======================================================
-  Copyright (C) 2021-2024 Nordix Foundation
+  Copyright (C) 2021-2025 OpenInfra Foundation Europe
   Modifications Copyright (C) 2021 Bell Canada
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
                             </configOptions>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>ncmp-code-gen-provmns</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <configuration>
+                            <inputSpec>https://forge.3gpp.org/rep/all/5G_APIs/-/raw/REL-18/TS28532_ProvMnS.yaml</inputSpec>
+                            <invokerPackage>org.onap.cps.ncmp.rest.provmns.controller</invokerPackage>
+                            <modelPackage>org.onap.cps.ncmp.rest.provmns.model</modelPackage>
+                            <apiPackage>org.onap.cps.ncmp.rest.provmns.api</apiPackage>
+                            <generatorName>spring</generatorName>
+                            <generateSupportingFiles>false</generateSupportingFiles>
+                            <configOptions>
+                                <sourceFolder>src/gen/java</sourceFolder>
+                                <dateLibrary>java11</dateLibrary>
+                                <interfaceOnly>true</interfaceOnly>
+                                <useSpringBoot3>true</useSpringBoot3>
+                                <useTags>true</useTags>
+                                <openApiNullable>false</openApiNullable>
+                                <skipDefaultInterface>true</skipDefaultInterface>
+                            </configOptions>
+                            <importMappings>
+                                <importMapping>Resource=org.onap.cps.ncmp.rest.provmns.model.Resource</importMapping>
+                            </importMappings>
+                            <ignoreFileOverride>${project.basedir}/.openapi-generator-ignore-provmns</ignoreFileOverride>
+                        </configuration>
+                    </execution>
                     <execution>
                         <id>ncmp-inventory-openapi-yaml-gen</id>
                         <goals>
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/provmns/model/Resource.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/provmns/model/Resource.java
new file mode 100644 (file)
index 0000000..29b3783
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe
+ *  ================================================================================
+ *  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.ncmp.rest.provmns.model;
+
+/**
+ * This interface serves as a replacement for the generated Resource class, which has dependencies on the NRM-related
+ * models that we want to avoid for our implementation of Provisioning and Management Services (ProvMnS) API.
+ */
+public interface Resource { }
index da0eecd..3b14ce7 100644 (file)
                         <exclude>org/onap/cps/rest/model/*</exclude>
                         <exclude>org/onap/cps/cpspath/parser/antlr4/*</exclude>
                         <exclude>org/onap/cps/ncmp/rest/model/*</exclude>
+                        <exclude>org/onap/cps/ncmp/rest/provmns/model/*</exclude>
                         <exclude>org/onap/cps/**/*MapperImpl.class</exclude>
                         <exclude>org/onap/cps/ncmp/rest/stub/*</exclude>
                         <exclude>org/onap/cps/policyexecutor/stub/model/*</exclude>