Skip to content
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

Promise error thrown on conversion to some formats #317

Open
kofalt opened this issue Jul 14, 2021 · 0 comments
Open

Promise error thrown on conversion to some formats #317

kofalt opened this issue Jul 14, 2021 · 0 comments

Comments

@kofalt
Copy link

kofalt commented Jul 14, 2021

Hi there - very neat project!
Trying this out with a fairly large OpenAPI 3.0.2 spec file.

Works great converting down to v2, throws a promise error trying for v1.
Easy way to reproduce:

# On Ubuntu 21.04
sudo apt update && sudo apt upgrade -y && sudo apt install -y nodejs npm && sudo reboot now
sudo npm install -g api-spec-converter

# Example file
wget https://gist.githubusercontent.com/kofalt/dd01bf2888a018c29241d0c8ac9791d4/raw/fe6ced0ff25f3c075802dc0b740a93438a46fde0/v3.json

# Works fine
api-spec-converter --from=openapi_3 --to=swagger_2 v3.json > v2.json

# Does not work
api-spec-converter --from=openapi_3 --to=swagger_1 v3.json > v1.json

# Also tried converting 2 -> 1, similar error
api-spec-converter --from=swagger_2 --to=swagger_1 v2.json > v1.json

Here's the stack trace:

Fatal Error: Unable to convert from openapi_3 to swagger_1
    at /usr/local/lib/node_modules/api-spec-converter/lib/base_format.js:168:13
    at tryCatcher (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:39:29)
    at module.exports.BaseFormat.convertTo (/usr/local/lib/node_modules/api-spec-converter/lib/base_format.js:162:21)
    at /usr/local/lib/node_modules/api-spec-converter/index.js:36:32
    at tryCatcher (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:461:21)

Might be there's a more important error being missed due to the async call? Not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant