Skip to content

Output of optic diff looks like a successful run, but it hides the errors that causes exit code 1 #2135

@gabsong

Description

@gabsong

Describe the bug
I think this is a bug, but it may be open to interpretation. Running:

optic diff --base <branch> <file_to_compare_against> --check

Gave the following output:

x Accounts API openapi/federation/external/swagger.2023-01.json
Preview docs:  https://useoptic.com/docs/cloud-get-started
Operations: 1 operation added
x  Checks: 36/48 passed (11 warnings)

specification details:
- /servers, /info/contact added
- /openapi, /info/version, /info/title changed

✔ POST /logistics/api/2023-01/accounts: added

  - request:
    - body application/json:
  - response 200:
    - body application/json:
  - response 401:
    - body application/json:
  - response 409:
    - body application/json:

...and 1 other endpoint

See the full history of this API by running "optic api add openapi/federation/external/swagger.2023-01.json --history-depth 0"

If I check the exit code, I get 1.

$ echo $?
1

To Reproduce
N/A

Expected behavior
I thought if there is an error causing the exit code 1, getting the output would be helpful. Or the exit code may be set on warnings? Because I do have warnings when running optic lint.

Screenshots
image

Details (please complete the following information):

  • OS and version: Ubuntu (CircleCI virtual env)
  • Optic version: 0.47.3
  • NodeJS version: 18

Additional context
For context, there's no file to compare to in the staging branch. Also, ran optic lint to check for errors, but there were none. I think the exit code may be wrong, or the output is hiding the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions