Enable swagger validation for each PR

* Update swagger:operation's to pass validation
* 'name' path parameter now used throughout API
* Added #/response/ok for 200 returns, TBD values have been replaced
  with legal values.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
Jhon Honce
2020-01-22 10:41:35 -07:00
parent c42383f70a
commit da1186ae63
14 changed files with 815 additions and 762 deletions

View File

@ -96,9 +96,7 @@ type swagLibpodInspectContainerResponse struct {
// swagger:response ListPodsResponse
type swagListPodsResponse struct {
// in:body
Body struct {
libpod.PodInspect
}
Body []libpod.PodInspect
}
// Inspect pod

View File

@ -27,34 +27,34 @@ func Error(w http.ResponseWriter, apiMessage string, code int, err error) {
WriteJSON(w, code, em)
}
func VolumeNotFound(w http.ResponseWriter, nameOrId string, err error) {
func VolumeNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchVolume {
InternalServerError(w, err)
}
msg := fmt.Sprintf("No such volume: %s", nameOrId)
msg := fmt.Sprintf("No such volume: %s", name)
Error(w, msg, http.StatusNotFound, err)
}
func ContainerNotFound(w http.ResponseWriter, nameOrId string, err error) {
func ContainerNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchCtr {
InternalServerError(w, err)
}
msg := fmt.Sprintf("No such container: %s", nameOrId)
msg := fmt.Sprintf("No such container: %s", name)
Error(w, msg, http.StatusNotFound, err)
}
func ImageNotFound(w http.ResponseWriter, nameOrId string, err error) {
func ImageNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchImage {
InternalServerError(w, err)
}
msg := fmt.Sprintf("No such image: %s", nameOrId)
msg := fmt.Sprintf("No such image: %s", name)
Error(w, msg, http.StatusNotFound, err)
}
func PodNotFound(w http.ResponseWriter, nameOrId string, err error) {
func PodNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchPod {
InternalServerError(w, err)
}
msg := fmt.Sprintf("No such pod: %s", nameOrId)
msg := fmt.Sprintf("No such pod: %s", name)
Error(w, msg, http.StatusNotFound, err)
}
@ -73,9 +73,11 @@ func BadRequest(w http.ResponseWriter, key string, value string, err error) {
}
type ErrorModel struct {
// root cause
// API root cause formatted for automated parsing
// example: API root cause
Because string `json:"cause"`
// error message
// human error message, formatted for a human to read
// example: human error message
Message string `json:"message"`
}