Skip to content

Commit 443246f

Browse files
authored
Merge pull request #74 from PublicisSapientParis/master
add fail-on-incompatible option
2 parents 582674d + 14ab8b7 commit 443246f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ usage: openapi-diff <old> <new>
7676
--query <property=value> use query param for authorisation
7777
--state Only output diff state: no_changes,
7878
incompatible, compatible
79+
--fail-on-incompatible Fail only if API changes broke backward compatibility
7980
--trace be extra verbose
8081
--version print the version information and exit
8182
--warn Print warning information

src/main/java/com/qdesrame/openapi/diff/Main.java

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public static void main(String... args) {
2828
.longOpt("state")
2929
.desc("Only output diff state: no_changes, incompatible, compatible")
3030
.build());
31+
options.addOption(
32+
Option.builder()
33+
.longOpt("fail-on-incompatible")
34+
.desc("Fail only if API changes broke backward compatibility")
35+
.build());
3136
options.addOption(Option.builder().longOpt("trace").desc("be extra verbose").build());
3237
options.addOption(
3338
Option.builder().longOpt("debug").desc("Print debugging information").build());
@@ -179,6 +184,8 @@ public static void main(String... args) {
179184
if (line.hasOption("state")) {
180185
System.out.println(result.isChanged().getValue());
181186
System.exit(0);
187+
} else if (line.hasOption("fail-on-incompatible")) {
188+
System.exit(result.isCompatible() ? 0 : 1);
182189
} else {
183190
System.exit(result.isUnchanged() ? 0 : 1);
184191
}

0 commit comments

Comments
 (0)