Skip to content

Conversation

mohamed-el-habib
Copy link
Contributor

I'm a trying to use this tool into my maven build and i want to fail build only if API changes broke backward compatibility. I'm manage to get the old version into ${basedir}/target/api-old.yaml.

With the --state option (#36) the exit code is always 0, i have to parse the stdout to get the status and i don't have the detail of changes.
With the --fail-on-incompatible the exit code 1 if API changes broke backward compatibility.

<plugin>
	<artifactId>maven-antrun-plugin</artifactId>
	<version>1.8</version>
	<executions>
		<execution>
			<id>openapi-backward</id>
			<phase>validate</phase>
			<goals>
				<goal>run</goal>
			</goals>
			<configuration>
				<tasks>
					<java fork="true" failonerror="true" classname="com.qdesrame.openapi.diff.Main">
						<arg value="${basedir}/target/api-old.yaml" />
						<arg value="${project.basedir}/src/main/resources/api.yaml" />
						<arg value="--fail-on-incompatible" />
						<classpath refid="maven.plugin.classpath" />
					</java>
				</tasks>
			</configuration>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>com.qdesrame</groupId>
			<artifactId>openapi-diff</artifactId>
			<version>2.0.0-SNAPSHOT</version>
		</dependency>
	</dependencies>
</plugin>

@quen2404
Copy link
Member

quen2404 commented Jan 8, 2020

Thank you @mohamed-el-habib !

@quen2404 quen2404 merged commit 443246f into OpenAPITools:master Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants