I am typing to generate in path parameters using go-swagger. But after running swagger generate spec -o ./swagger.yaml --scan-models
I see the generated swagger has in:query
rather than in:path
package types
package types
type URCapID struct {
Vendor string `yaml:"vendorID" json:"vendorID" mapstructure:"vendorID"`
ID string `yaml:"urcapID" json:"urcapID" mapstructure:"urcapID"`
Version string `yaml:"version" json:"version" mapstructure:"version"`
}
Handle function
// swagger:parameters deleteURCap
type urcapIDParam struct {
// The id of the urcap to uninstall/delete
// in: path
// required: true
types.URCapID
}
// Uninstall and deletes urcap if installed
func Uninstall(w http.ResponseWriter, r *http.Request) {
// swagger:route DELETE /urcap/{vendorID}/{urcapID}/{version} URCap deleteURCap
//
// Delete/Uninstall URCap if installed.
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http
//
// Responses:
// 201: noContent
}
Auto generated swagger.yaml
/urcap/{vendorID}/{urcapID}/{version}:
delete:
consumes:
- application/json
operationId: deleteURCap
parameters:
- in: query
name: vendorID
type: string
x-go-name: Vendor
- in: query
name: urcapID
type: string
x-go-name: ID
- in: query
name: version
type: string
x-go-name: Version
produces:
- application/json
responses:
"201":
$ref: '#/responses/noContent'
schemes:
- http
summary: Delete/Uninstall URCap if installed.
tags:
- URCap