Skip to content

add fail-on-incompatible option #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
added fail-on-incompatible option
  • Loading branch information
mohamed-el-habib committed May 19, 2019
commit 56a0fd5154fa70024f05e2dcf730d3e51e7c34d7
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
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
12 changes: 12 additions & 0 deletions src/main/java/com/qdesrame/openapi/diff/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ public static void main(String... args) {
.longOpt("state")
.desc("Only output diff state: no_changes, incompatible, compatible")
.build());
options.addOption(
Option.builder()
.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 +189,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