Skip to content

Commit

Permalink
Merge pull request #74 from PublicisSapientParis/master
Browse files Browse the repository at this point in the history
add fail-on-incompatible option
  • Loading branch information
quen2404 committed Jan 8, 2020
2 parents 582674d + 14ab8b7 commit 443246f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -76,6 +76,7 @@ usage: openapi-diff <old> <new>
--query <property=value> use query param for authorisation
--state Only output diff state: no_changes,
incompatible, compatible
--fail-on-incompatible Fail only if API changes broke backward compatibility
--trace be extra verbose
--version print the version information and exit
--warn Print warning information
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/qdesrame/openapi/diff/Main.java
Expand Up @@ -28,6 +28,11 @@ public static void main(String... args) {
.longOpt("state")
.desc("Only output diff state: no_changes, incompatible, compatible")
.build());
options.addOption(
Option.builder()
.longOpt("fail-on-incompatible")
.desc("Fail only if API changes broke backward compatibility")
.build());
options.addOption(Option.builder().longOpt("trace").desc("be extra verbose").build());
options.addOption(
Option.builder().longOpt("debug").desc("Print debugging information").build());
Expand Down Expand Up @@ -179,6 +184,8 @@ public static void main(String... args) {
if (line.hasOption("state")) {
System.out.println(result.isChanged().getValue());
System.exit(0);
} else if (line.hasOption("fail-on-incompatible")) {
System.exit(result.isCompatible() ? 0 : 1);
} else {
System.exit(result.isUnchanged() ? 0 : 1);
}
Expand Down

0 comments on commit 443246f

Please sign in to comment.