swagger-autogen icon indicating copy to clipboard operation
swagger-autogen copied to clipboard

Parser doesn't seem to handle generic TS types

Open ZRunner opened this issue 3 years ago • 1 comments

Hello

It looks like the file parsed used for this lib does not correctly handle TS generic types, at least for the Request object.

I have the following function signature for one of my endpoints:

export async function createBoard(req: Request<{id: string}, {}, CreateBoard>, res: MyResponse) {
 /* ... */
}

and my configuration comments are ignored for this specific endpoint. Removing the generic type, thus using

export async function createBoard(req: Request, res: MyResponse) {
 /* ... */
}

works just fine.

ZRunner avatar Sep 22 '22 23:09 ZRunner

Hi @ZRunner! Thank you for opening the issue.

I'll try to fix this as soon as possible. Any news, I'll post it here.

davibaltar avatar Oct 01 '22 00:10 davibaltar

@ZRunner Using unknown or any solved the problem

export async function createBoard(req: Request<{id: string}, unknown, CreateBoard>, res: MyResponse) { /* ... */ }

Kishimy avatar Nov 10 '22 08:11 Kishimy

From what I can see, Request<{id: string}, unknown, CreateBoard> doesn't fix the issue but Request<any, unknown, CreateBoard> does. Which requires loosing quite a bit of information :/

@davibaltar do you have any approximate ETA for the fix of this issue? Or is the project discontinued?

ZRunner avatar Nov 10 '22 22:11 ZRunner