Open EloiLeanovia opened 3 years ago
Hi,
I'll take a look and get back with a solution shortly
Any update on this?
I am also having issues with this error.
Hi, I think I have targeted the problem. In the src/logic/documentor.js file on line 31. The problem was that only Content-Type: application/json cases were processed. So, if your swagger contains others Content-Type such as application/xml or text/plain, it crashes.
The solution I found was to add :
if (this._openapi && content) { const {'application/json': app_json} = content; if(app_json){ this._mapping[mapping_key][code] = app_json.schema; } }
instead of
if (this._openapi && content) { const {'application/json': app_json} = content; this._mapping[mapping_key][code] = app_json.schema; }
to make it works (only with JSON)
@paulcruse-syn does it seems you a correct solution ? I have to notify you that I have another issue (I will open a new ticket issue for it) : commands are working, I have no error but it does not write the tests in the collection. I don't know if it's related to my modification.
Thanks in advance for your replies :)
@EloiLeanovia this is great!
Can you make a PR withe changes and a test case to cover it?
@EloiLeanovia this is great!
Can you make a PR withe changes and a test case to cover it?
Yes I will do that if I can make it works totally.
@EloiLeanovia this is great! Can you make a PR withe changes and a test case to cover it?
Yes I will do that if I can make it works totally.
was the PR created? ;)
Hi, I'm currently trying to use your tool, which looks super cool.
I have documentation generated by a springboot plugin, and I'm trying to get the automatic test generation to work with it.
However, when running the following command : My command
I get this error:
(node:14871) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'schema' of undefined at Documentor._mapPathSchemas (/Users/juszczak/.npm/_npx/14871/lib/node_modules/@syngenta-digital/pdt/src/logic/documentor.js:33:69) at Documentor.importSchema (/Users/juszczak/.npm/_npx/14871/lib/node_modules/@syngenta-digital/pdt/src/logic/documentor.js:19:14) at async _runPostManMerges (/Users/juszczak/.npm/_npx/14871/lib/node_modules/@syngenta-digital/pdt/src/index.js:8:5) at async Object.exports.run (/Users/juszczak/.npm/_npx/14871/lib/node_modules/@syngenta-digital/pdt/src/index.js:35:5) (Use
node --trace-warnings ...to show where the warning was created) (node:14871) 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:14871) [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.
I had a look at your code, but I came to the conclusion that the problem must come from my documentation file. However, this one is automatically generated and is perfectly interpreted by swagger ui.
So, I've come to ask you for a little help, in case you have any idea why I'm getting this error.
Here is my open-api file.
Thanks in advance :)