changeset 300:428e596f867d

Test for inconsistencies in YAML files This patch, using an updated thermostat-common jar, runs a build-time test for inconsistent YAML specifications. Missing definitions, or conflicts between default values or required/not required, or similarly named but different objects are found. Differing descriptions are ignored. The output appear in the build but doesn't break the build. A separate patch will address the issues found. Reviewed-by: neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-October/025559.html
author Simon Tooke <stooke@redhat.com>
date Fri, 27 Oct 2017 14:39:15 -0400
parents 1d0ab7b56781
children f72a7db944c9
files pom.xml services/schema/pom.xml
diffstat 2 files changed, 53 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pom.xml	Thu Oct 26 12:20:15 2017 -0400
+++ b/pom.xml	Fri Oct 27 14:39:15 2017 -0400
@@ -60,7 +60,7 @@
     </modules>
 
     <properties>
-        <thermostat.common.version>0.1.1</thermostat.common.version>
+        <thermostat.common.version>0.1.3</thermostat.common.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
--- a/services/schema/pom.xml	Thu Oct 26 12:20:15 2017 -0400
+++ b/services/schema/pom.xml	Fri Oct 27 14:39:15 2017 -0400
@@ -52,6 +52,58 @@
 
     <build>
         <plugins>
+
+
+             <!-- generate list of swagger files -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>listSwaggerFiles</id>
+                        <phase>test</phase>
+                        <configuration>
+                            <tasks>
+                                <mkdir dir="${project.build.directory}"/>
+                                <pathconvert property="swagger.matches" pathsep="${line.separator}">
+                                    <fileset dir="${basedir}/.." includes="**/src/main/resources/*-swagger.*"/>
+                                </pathconvert>
+                                <echo message="found Swagger files: ${line.separator}${swagger.matches}"/>
+                                <echo message="${swagger.matches}" file="${project.build.directory}/swaggerfiles.txt"/>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- combine swagger files with no output -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>1.6.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>java</goal>
+                        </goals>
+                        <phase>test</phase>
+                    </execution>
+                </executions>
+                <configuration>
+                    <mainClass>com.redhat.thermostat.common.swaggercombine.SwaggerCombineMain</mainClass>
+                    <arguments>
+                        <argument>--lint</argument>
+                        <argument>--output=</argument>
+                        <argument>--throw</argument>
+                        <argument>${basedir}/src/main/webapp/WEB-INF/swagger-template.json</argument>
+                        <argument>@${project.build.directory}/swaggerfiles.txt</argument>
+                    </arguments>
+                </configuration>
+            </plugin>
+
             <!-- ensure war file includes docs directory -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>