Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ public class OpenApiDiffMojo extends AbstractMojo {
@Parameter(property = "failOnChanged", defaultValue = "false")
Boolean failOnChanged = false;

@Parameter(property = "skip", defaultValue = "false")
Boolean skip = false;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if(Boolean.TRUE.equals(skip)) {
getLog().info("Skipping openapi-diff execution");
return;
}

try {
final ChangedOpenApi diff = OpenApiCompare.fromLocations(oldSpec, newSpec);
getLog().info(new ConsoleRender().render(diff));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,15 @@ void Should_BackwardIncompatibilityException_When_WantsExceptionAndSpecIsIncompa

assertThrows(BackwardIncompatibilityException.class, mojo::execute);
}

@Test
void Should_Skip_Mojo_WhenSkipIsTrue() {
final OpenApiDiffMojo mojo = new OpenApiDiffMojo();
mojo.oldSpec = new File("src/test/resources/newspec.yaml").getAbsolutePath();
mojo.newSpec = new File("src/test/resources/oldspec.yaml").getAbsolutePath();
mojo.failOnIncompatible = true;
mojo.skip = true;

assertDoesNotThrow(mojo::execute);
}
}
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down