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
There was a problem resolving type of 'ConflictErrorWithDetailsDuplicatesFoundResult'.
/Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:235
throw err;
^
TypeError: Cannot read property 'typeParameters' of undefined
at buildGenericTypeMap (/Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:581:14)
at resolveTypeArguments (/Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:590:18)
at /Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:516:34
at Array.forEach (<anonymous>)
at /Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:509:22
at Array.forEach (<anonymous>)
at getInheritedProperties (/Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:505:21)
at getReferenceType (/Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:228:34)
at Object.resolveType (/Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:76:25)
at /Users/tnrich/Sites/lims/tg-cli-api/node_modules/typescript-rest-swagger/dist/metadata/endpointGenerator.js:117:37
at Array.map (<anonymous>)
I dug deeper by debugging in node inspector:
As you can see in the above image, the actual issue is that type===undefined we should at the very least return a better error message when type===undefined. I'll put a PR in for that right now.
After understanding the issue better, I was able to fix it by explicitly importing: import { ConflictError, HttpError } from "typescript-rest/dist/server/model/errors";
instead of import { Errors } from "typescript-rest";
That can work for right now but seems like an imperfect solution (because ConflictError, HttpError aren't exposed as top level exports in typescript-rest).
It seems like the best solution would be improve the typescript-rest-swagger MetadataGenerator to properly find all the included types coming from a top-level import.
Thanks!
The text was updated successfully, but these errors were encountered:
Hey @thiagobustamante and whoever else maintains this! Thanks again for the awesome tool!
So.. I was generating swagger json using swaggerGen:
Here are some of the types:
I then use that here in a
@Response
tag:I was getting a difficult to debug error:
I dug deeper by debugging in node inspector:
As you can see in the above image, the actual issue is that
type===undefined
we should at the very least return a better error message whentype===undefined
. I'll put a PR in for that right now.After understanding the issue better, I was able to fix it by explicitly importing:
import { ConflictError, HttpError } from "typescript-rest/dist/server/model/errors";
instead of
import { Errors } from "typescript-rest";
That can work for right now but seems like an imperfect solution (because ConflictError, HttpError aren't exposed as top level exports in typescript-rest).
It seems like the best solution would be improve the typescript-rest-swagger MetadataGenerator to properly find all the included types coming from a top-level import.
Thanks!
The text was updated successfully, but these errors were encountered: