路線:細末招搖着路徑PARAM
// swagger:route DELETE /v1/path/{id} api DeleteV1
//
// Deletes an item.
//
// Schemes: https
//
// Responses:
// 202: AcceptedResponse
// 401: UnauthorizedErrorResponse
// 500: InternalServerErrorResponse
"/v1/path/{id}": {
"DELETE": Handle(DeleteRequest{}),
"OPTIONS": s.handleOptionsRequest,
},
PARAMS /響應模型:
// Description
//
// swagger:parameters DeleteV1
type DeleteRequest struct {
// id of an item
//
// In: path
id string `json:"id"`
cookies []*http.Cookie
}
// Description
//
// swagger:response DeleteResponse
type DeleteResponse struct {
}
我不斷收到- path param "{id}" has no parameter definition
不管我試試。
端點只接受路徑參數「id」,cookie(它們在swagger模型中不可見)並返回一個空主體和一個HTTP狀態碼。
如何使swagger看到「參數定義」爲「{id}」?
@ Flimzy,是的我試過,「Id」它說「ID不存在路徑」。 JSON的事情是一個絕望的嘗試,我根本不需要JSON。 – exebook
@Flimzy我只是試圖讓它導出,它的工作!我之前嘗試利用它可能還有另一個錯誤。 – exebook
不錯!那麼我已經將我的建議轉化爲答案。 – Flimzy