OpenAPITools / openapi-diff

Utility for comparing two OpenAPI specifications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`--state` option outputs `metadata`

Dogacel opened this issue · comments

From help,

    --state                     Only output diff state: no_changes,
                                incompatible, compatible

this doesn't align with reality. We had a case where the state outputted metadata.

Caused by this line:

System.out.println(result.isChanged().getValue());

We can simply

to include something like

public DiffResult toStateDiff() {
  if (this.isUnchanged()) {
    return DiffResult.UNCHANGED;
  }

 if (this.isCompatible()) {
    return DiffResult.COMPATIBLE;
 }

 return DiffResult.INCOMPATIBLE;
}