go-swagger3
go-swagger3 copied to clipboard
Model composition in response
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.
You can use interface type but the over ridding functionality is not there as of now.
You can use interface type but the over ridding functionality is not there as of now.
interface can`t desc complete data type, I want generate JS api code with swagger.json