1

According to the docs if we want to define query params as a struct we need to list every single operation that uses them after the struct. This will prove exhausting for an API with hundreds of endpoints that all use the same query params that could change down the road.

Instead of adding

//  Parameters:
//      + name: limit
//        type: number
//        in: query
//        example: 500
//      + name: offset
//        type: number
//        in: query
//        example: 50
//      + name: sort
//        type: string
//        in: query
//        description: property sort order
//        example: +name

to every GET we have an editing it down the road we would like something along the lines of how models work

//      + name: query params
//        type: QueryParams

along with

// swagger:model QueryParams
type QueryParams struct {
    //in: query
    Limit int `json:"limit"`
    //in: query
    Offset int `json:"offset"`
    //in: query
    Sort string `json:"sort"`
}

although this does not appear to work with swagger:model or swagger:parmameters is there any way to get a nice clean centralized query params without listing ever GET operation id next to the params struct?

0 Answers0