You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
swagger.json is generated?
Current Behavior
> tsoa swagger
Generate swagger error.
TypeError: Cannot set property 'examples' of undefined
at {root}\node_modules\tsoa\dist\swagger\specGenerator3.js:290:92
at Array.forEach (<anonymous>)
at SpecGenerator3.buildOperation ({root}\node_modules\tsoa\dist\swagger\specGenerator3.js:273:26)
at SpecGenerator3.buildMethod ({root}\node_modules\tsoa\dist\swagger\specGenerator3.js:244:60)
at {root}\node_modules\tsoa\dist\swagger\specGenerator3.js:237:23
at Array.forEach (<anonymous>)
at {root}\node_modules\tsoa\dist\swagger\specGenerator3.js:232:18
at Array.forEach (<anonymous>)
at SpecGenerator3.buildPaths ({root}\node_modules\tsoa\dist\swagger\specGenerator3.js:227:35)
at SpecGenerator3.GetSpec ({root}\node_modules\tsoa\dist\swagger\specGenerator3.js:54:25)
or maybe throw an exception when this if check on line 287 fails
if(res.schema&&!isVoidType(res.schema)){
Steps to Reproduce
not exactly sure what steps are needed.
Context (Environment)
Version of the library: 3.2.1
Version of NodeJS: 13.12.0
Confirm you were using yarn not npm: [ ]
Detailed Description
This issue appears to have been introduced in commit 75149bc when an if check was put around adding a content property to swaggerResponses[res.name] in the buildOperation function in SpecGenerator3. I don't know if there is something else wrong with my setup that is causing res.schema to not be set but this looks like a valid scenario from what I can tell.
If swaggerResponses[res.name].content is not set (due to res.schema not being set) then an empty object is used and since that empty object does not have an 'application/json' property an exception is thrown trying to set it's examples property.
Breaking change?
The text was updated successfully, but these errors were encountered:
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
swagger.json is generated?
Current Behavior
Possible Solution
Change line 299 from
to
or maybe throw an exception when this if check on line 287 fails
Steps to Reproduce
not exactly sure what steps are needed.
Context (Environment)
Version of the library: 3.2.1
Version of NodeJS: 13.12.0
Detailed Description
This issue appears to have been introduced in commit 75149bc when an if check was put around adding a content property to swaggerResponses[res.name] in the buildOperation function in SpecGenerator3. I don't know if there is something else wrong with my setup that is causing res.schema to not be set but this looks like a valid scenario from what I can tell.
If swaggerResponses[res.name].content is not set (due to res.schema not being set) then an empty object is used and since that empty object does not have an 'application/json' property an exception is thrown trying to set it's examples property.
Breaking change?
The text was updated successfully, but these errors were encountered: