Open milanbr opened 6 years ago
Can you share your apibp file? The command works for me with this one:
https://raw.githubusercontent.com/apiaryio/api-blueprint/master/examples/Polls%20API.md
Same here, when converting from openapi_3 to swagger_2
Same happens to me. From api_blueprint
to openapi_3
If anyone can share a file that triggers this bug, I'm happy to try and reproduce.
Unfortunately I cannot share because definition contains company internal APIs, maybe @milanbr or @canvural can?
The error occurs in api-spec-converter/node_modules/composite-error/lib/compositeError.js
on line 45. I've added console.log(this.originalStackDescriptor);
to check what's happening:
{ value: 'CompositeError: Failed to parse spec\n at Promise.any.catch.err (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/lib/base_format.js:119:13)\n at tryCatcher (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)\n at /home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/catch_filter.js:17:41\n at tryCatcher (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:512:31)\n at Promise._settlePromise (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:569:18)\n at Promise._settlePromiseCtx (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:606:10)\n at _drainQueueStep (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:142:12)\n at _drainQueue (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:131:9)\n at Async._drainQueues (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:147:5)\n at Immediate.Async.drainQueues (/home/jan/.asdf/installs/nodejs/8.10.0/.npm/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:17:14)\n at runCallback (timers.js:794:20)\n at tryOnImmediate (timers.js:752:5)\n at processImmediate [as _immediateCallback] (timers.js:729:5)',
writable: true,
enumerable: false,
configurable: true }
api-spec-converter
tries to call .get
on this object, but there is no get
-key.
Edit: api_blueprint
to openapi_3
.
Edit: :arrow_right: We used integer
instead of number
in some cases. This caused the parser error. :arrow_left:
Thanks for the details!
Unfortunately I wasn't able to trigger the error by setting a query parameter to integer
- any more details you can share on how to reproduce?
I had the same problem and added another line in bluebirds promise.js (line 658) to track the problem down:
console.log(JSON.stringify(reason, null, 4));
This is the error message I got:
{
"name": "CompositeError",
"message": "Failed to parse spec",
"innerErrors": [
{
"result": {
"_version": "2.2",
"error": {
"code": 2,
"message": "the use of carriage return(s) '\\r' in source data isn't currently supported, please contact makers",
"location": [
{
"index": 1087,
"length": 1
}
]
},
"warnings": []
}
}
],
After a change all line-endings to LF (unix) the converter worked
Encountered the same issue trying to convert the apibp file downloaded from https://gost1.docs.apiary.io/ Attached: gost1.apib.txt
I had same problem as @gunters63 . File was saved with CRLF. Saving file as Unix style solves the problem.
@rbren IMHO It will be sufficient to handle error message and raise more specific message. Original error message is really confusing.
When run:
api-spec-converter pisp.apib --from=api_blueprint --to=swagger_2 > swagger.json
I get: