go-swagger3 icon indicating copy to clipboard operation
go-swagger3 copied to clipboard

Model composition in response

Open wubiandaxian opened this issue 2 years ago • 2 comments

This is what swaggo can do:

// JSONResult's data field will be overridden by the specific type proto.Order
@success 200 {object} ReturnValue {data=proto.Order} "desc"

then custom struce can as a common response type like :

type ReturnValue struct {
	Data   interface{} `json:"data"`
	Status uint        `json:"status" example:"0"`
	Msg    string      `json:"msg" example:"成功"`
}

when I use struct ReturnValue as success response , I can put the truely model in data field. Does this lib support this? I didn`t found it in docs.

wubiandaxian avatar Jun 17 '22 09:06 wubiandaxian