Ryan-Sin / swagger-nestjs-codegen

MIT License
20 stars 4 forks source link

Cannot read property 'x-codegen-request-body-name' of undefined #4

Open d9k opened 1 year ago

d9k commented 1 year ago

I added x-codegen-request-body-name and operationId to my openapi.yaml file but still getting errors. Last error was Cannot read property 'x-codegen-request-body-name' of undefined.

Too little error context to solve it, unfortunately.

> codegen -s openapi-fixed.yaml -p my-service
? Do you want to create a database module? not
? Do you want to create a kafka module? not
? Do you want to create a project? Yes
(node:1161517) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'x-codegen-request-body-name' of undefined
    at processingResponseData (/home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/lib/path-response-processing.js:20:30)
    at /home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/lib/codegen.js:319:11
    at /home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/node_modules/lodash/lodash.js:3032:24)
    at /home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/node_modules/lodash/lodash.js:4936:18
    at Function.forEach (/home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/node_modules/lodash/lodash.js:9410:14)
    at /home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/lib/codegen.js:181:7
    at /home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/node_modules/lodash/lodash.js:3032:24)
    at /home/d9k/.nvm/versions/node/v14.16.1/lib/node_modules/@newko/swagger-nestjs-codegen/node_modules/lodash/lodash.js:4936:18
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1161517) 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:1161517) [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.
d9k commented 1 year ago

Please provide path to the missing node in the error message

d9k commented 1 year ago

ok, I debugged with VS Code

the problem line:

responses["200"]["x-codegen-request-body-name"]

No 200 code in my responses, just 201 (Created)...

d9k commented 1 year ago

opened MR #5

Ryan-Sin commented 1 year ago

I know what you're talking about. I'll let you.