Replace swagger doc gen with commmon approach 39/122639/2
authorliamfallon <liam.fallon@est.tech>
Wed, 14 Jul 2021 16:52:12 +0000 (17:52 +0100)
committerliamfallon <liam.fallon@est.tech>
Thu, 15 Jul 2021 13:58:20 +0000 (14:58 +0100)
The swagger documentation generation is moved to policy-parent. This
commit removes the CLAMP swagger document generation and replaces it
with the common handling.

It also fixes the following bug:
The current CLAMP build generates the swagger.json file using a unit
test case. That file is used later in the build to generate a
swagger.pdf and swagger.html file. If the tests are skipped, the
swagger.json file is not generated and the build fails on the PDF/html
generation step.

This change adds a profile to the build that only does the PDF/html
generation when the skipTests flag is off.

Issue-ID: POLICY-3424
Change-Id: Id195fc600d8fca7bfa5d9003272520d57414d646
Signed-off-by: liamfallon <liam.fallon@est.tech>
runtime/pom.xml
runtime/src/main/resources/asciidoc/swagger.adoc [deleted file]

index 4c8bf24..d55c2ca 100644 (file)
@@ -97,6 +97,9 @@
         <ui.react.src>ui-react</ui.react.src>
         <ui.react.lib.src>ui-react-lib</ui.react.lib.src>
         <npm.publish.url>https://nexus3.onap.org/repository/npm.snapshot/</npm.publish.url>
+
+        <!--  This property triggers generation of the Swagger documents -->
+        <swagger.generation.phase>post-integration-test</swagger.generation.phase>
     </properties>
 
     <profiles>
             </properties>
         </profile>
     </profiles>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
                 </executions>
 
             </plugin>
-            <!-- Read the swagger.json file and the definition from SwaggerConfig.java; generate
-                a list of .adoc files containing the APIs info in more structured way -->
-            <plugin>
-                <groupId>io.github.swagger2markup</groupId>
-                <artifactId>swagger2markup-maven-plugin</artifactId>
-                <version>1.3.3</version>
-                <dependencies>
-                    <dependency>
-                        <groupId>io.github.swagger2markup</groupId>
-                        <artifactId>swagger2markup-import-files-ext</artifactId>
-                        <version>1.3.3</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>io.github.swagger2markup</groupId>
-                        <artifactId>swagger2markup-spring-restdocs-ext</artifactId>
-                        <version>1.3.3</version>
-                    </dependency>
-                </dependencies>
-                <configuration>
-                    <swaggerInput>${project.build.directory}/swagger/swagger.json</swaggerInput>
-                    <outputDir>${project.build.directory}/asciidoc/generated</outputDir>
-                    <config>
-                        <swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage>
-                    </config>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>post-integration-test</phase>
-                        <goals>
-                            <goal>convertSwagger2markup</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <!-- Run the generated asciidoc through Asciidoctor to generate other documentation
-                types, such as PDFs or HTML5 -->
-            <plugin>
-                <groupId>org.asciidoctor</groupId>
-                <artifactId>asciidoctor-maven-plugin</artifactId>
-                <version>1.5.7.1</version>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.asciidoctor</groupId>
-                        <artifactId>asciidoctorj-pdf</artifactId>
-                        <version>1.5.0-alpha.10.1</version>
-                    </dependency>
-                </dependencies>
-                <configuration>
-                    <sourceDirectory>${project.basedir}/src/main/resources/asciidoc</sourceDirectory>
-                    <sourceDocumentName>swagger.adoc</sourceDocumentName>
-                    <attributes>
-                        <doctype>book</doctype>
-                        <toc>left</toc>
-                        <toclevels>3</toclevels>
-                        <numbered/>
-                        <hardbreaks/>
-                        <sectlinks/>
-                        <sectanchors/>
-                        <generated>${project.build.directory}/asciidoc/generated</generated>
-                    </attributes>
-                </configuration>
 
-                <executions>
-                    <execution>
-                        <id>output-html</id>
-                        <phase>post-integration-test</phase>
-                        <goals>
-                            <goal>process-asciidoc</goal>
-                        </goals>
-                        <configuration>
-                            <backend>html5</backend>
-                            <outputDirectory>${project.build.directory}/swagger</outputDirectory>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>output-pdf</id>
-                        <phase>post-integration-test</phase>
-                        <goals>
-                            <goal>process-asciidoc</goal>
-                        </goals>
-                        <configuration>
-                            <backend>pdf</backend>
-                            <outputDirectory>${project.build.directory}/swagger</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
             <plugin>
                 <groupId>org.codehaus.groovy.maven</groupId>
                 <artifactId>gmaven-plugin</artifactId>
diff --git a/runtime/src/main/resources/asciidoc/swagger.adoc b/runtime/src/main/resources/asciidoc/swagger.adoc
deleted file mode 100644 (file)
index 6896747..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include::{generated}/overview.adoc[]
-include::{generated}/paths.adoc[]
-include::{generated}/security.adoc[]
-include::{generated}/definitions.adoc[]
\ No newline at end of file