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

does swaggo support defining cookie in the header?

Open gzhhong opened this issue 4 years ago • 6 comments

Hello all,

I can't find in the docs if I can define a parameter in this way:

// @Param some_id cookie string true "Some ID"

Can anyone confirm there are some way to do so?

Thanks,

James

gzhhong avatar Nov 23 '20 01:11 gzhhong

I think that cookie type is only support OAS 3.0, but swag support only OAS 2.0 - https://github.com/swaggo/swag/issues/237 swagg Support types - https://github.com/swaggo/swag#param-type

AntonDzyk avatar Dec 25 '20 20:12 AntonDzyk

? no update?
i manually changed the json in docs.go parameters.in to "cookie" which works

renchili avatar Mar 23 '22 09:03 renchili

@ubogdan

any update on this? Would be very nice to have support on this!

boindil avatar Jun 02 '22 09:06 boindil

You could use @Param:

// @Param 		 Cookie header string  false "token"     default(token=xxx)

ahuigo avatar Nov 02 '22 09:11 ahuigo

You could use @Param:

// @Param 		 Cookie header string  false "token"     default(token=xxx)

I might be wrong, but I don't think this will yield the intended result. If you want to place a JWT token in a Cookie, then the swagger document that is generated by swag init will have to be manually edited to include the specification of the cookie since swag only supports the Swagger 2.0 specification and cookie authentication is a Swagger 3.0 feature.

ballcoach12 avatar Jan 30 '24 16:01 ballcoach12