Redocly/create-openapi-repo

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'parameters' of undefined

julianlam opened this issue · 2 comments

Repro steps:

yarn global add create-openapi-repo
mkdir apiDocs
cd apiDocs
cp /path/to/preexistingopenapi.yaml .
create-openapi-repo

Output:

$ create-openapi-repo 
Welcome to the OpenAPI-Repo generator!
? Do you already have an OpenAPI/Swagger 3.0 definition for your API? Yes
? Please specify the path to the OpenAPI definition (local file): ./openapi.yaml


? API Name: Read/Write API
? The following folders will be created: openapi and docs
You can change them by running create-openapi-repo <openapiDir> <docsDir>
Proceed? Yes

Creating a new OpenAPI repo in /home/julian/Projects/nodebb/apidocs

(node:29459) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'parameters' of undefined
    at module.exports (/home/julian/.config/yarn/global/node_modules/create-openapi-repo/lib/split-definition.js:84:29)
    at run (/home/julian/.config/yarn/global/node_modules/create-openapi-repo/cli.js:196:3)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:29459) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:29459) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Node.js v13.8.0
npm@6.13.6 /usr/lib/node_modules/npm
yarn 1.21.1

Any chance you can supply the actual preexistingopenapi.yaml file?

Since I opened the issue, I trimmed down the file quite a bit (it was auto-generated, initially), and create-openapi-repo seems to be working fine now, thanks :)