Skip to content

Model composition in response #9

@wubiandaxian

Description

@wubiandaxian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions