OpenAPITools/openapi-diff

`--state` option outputs `metadata`

Open

#508 aberto em 18 de abr. de 2023

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)Java (187 forks)user submission
good first issue

Métricas do repositório

Stars
 (1.079 stars)
Métricas de merge de PR
 (Mesclagem média 38d 22h) (15 fundiu PRs em 30d)

Description

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: https://github.com/OpenAPITools/openapi-diff/blob/1de574d3ca447bc463740bc10c37851702974a00/cli/src/main/java/org/openapitools/openapidiff/cli/Main.java#L203

We can simply https://github.com/OpenAPITools/openapi-diff/blob/1de574d3ca447bc463740bc10c37851702974a00/core/src/main/java/org/openapitools/openapidiff/core/model/DiffResult.java#L5

to include something like

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

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

 return DiffResult.INCOMPATIBLE;
}

Guia do colaborador