oas icon indicating copy to clipboard operation
oas copied to clipboard

OAS validate returns error but no indication it's source.

Open ChildishhAlbino opened this issue 5 years ago • 2 comments

Running oas validate ./swagger.yaml returns an error (which is expected). However, it does not give any indication of which file and what line that file is causing the error.

This has caused a massive headache of having to scour over lines of code to find very small indentation errors with almost no idea of where they are coming from.

Is this a possible feature to be added?

ChildishhAlbino avatar Jun 02 '20 06:06 ChildishhAlbino

You have an example of the output that you received from an error state?

erunion avatar Jun 03 '20 23:06 erunion

Unhandled rejection Error: YAMLException: bad indentation of a mapping entry at line 26, column 29:
                      properties:
                                ^
    at /usr/local/lib/node_modules/oas/node_modules/swagger-inline/build/swagger-inline.js:108:19
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/oas/node_modules/swagger-inline/build/swagger-inline.js:88:25
    at tryCatcher (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:673:18)
    at Promise._resolveCallback (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:466:57)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:559:17)
    at Promise._settlePromise (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:673:18)
    at MappingPromiseArray.PromiseArray._resolve (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise_array.js:127:19)

The lines causing the error were nowhere near line 26, column 29.

It would be nice if the error was more like

Unhandled rejection Error: YAMLException: bad indentation of a mapping entry at line <lineNumber>, column <columnNumber> @ <fileName>:
                      properties:
                                ^
    at /usr/local/lib/node_modules/oas/node_modules/swagger-inline/build/swagger-inline.js:108:19
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/oas/node_modules/swagger-inline/build/swagger-inline.js:88:25
    at tryCatcher (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:673:18)
    at Promise._resolveCallback (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:466:57)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:559:17)
    at Promise._settlePromise (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise.js:673:18)
    at MappingPromiseArray.PromiseArray._resolve (/usr/local/lib/node_modules/oas/node_modules/bluebird/js/release/promise_array.js:127:19)```

ChildishhAlbino avatar Jun 05 '20 04:06 ChildishhAlbino