Render swagger-ui for dmi-plugin and dmi-plugin-internal 01/141301/4
authoregernug <gerard.nugent@est.tech>
Mon, 16 Jun 2025 13:12:07 +0000 (14:12 +0100)
committeregernug <gerard.nugent@est.tech>
Tue, 17 Jun 2025 09:27:28 +0000 (10:27 +0100)
- Added resource-copy to maven-resources-plugin to make openapi.yaml available to swagger-ui

Issue-ID: CPS-2856

Change-Id: Ida9f14743b03b54680b259cf267a39a52e7a9305
Signed-off-by: egernug <gerard.nugent@est.tech>
dmi-service/pom.xml

index 487e958..60efb44 100644 (file)
                             </configOptions>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>openapi-yaml-gen</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <inputSpec>https://gerrit.onap.org/r/gitweb?p=cps.git;a=blob_plain;f=docs/api/swagger/dmi/openapi.yml</inputSpec>
+                            <generatorName>openapi-yaml</generatorName>
+                            <configOptions>
+                                <outputFile>openapi.yaml</outputFile>
+                            </configOptions>
+                        </configuration>
+                    </execution>
+                    </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>${maven-resources-plugin.version}</version>
+                <executions>
+                    <execution>
+                        <id>copy-for-swagger-ui</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.basedir}/target/classes/static/api-docs</outputDirectory>
+                            <overwrite>true</overwrite>
+                            <resources>
+                                <resource>
+                                    <directory>${project.basedir}/target/generated-sources/openapi/</directory>
+                                    <includes>
+                                        <include>openapi.yaml</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>