Merge pull request #12160 from matejvasek/fix-swagger-api

Fix swagger definitions
This commit is contained in:
OpenShift Merge Robot
2021-11-02 12:46:25 +01:00
committed by GitHub
3 changed files with 14 additions and 5 deletions

View File

@ -103,7 +103,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// - application/json // - application/json
// responses: // responses:
// 200: // 200:
// $ref: "#/responses/DockerImageSummary" // $ref: "#/responses/DockerImageSummaryResponse"
// 500: // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/json"), s.APIHandler(compat.GetImages)).Methods(http.MethodGet) r.Handle(VersionedPath("/images/json"), s.APIHandler(compat.GetImages)).Methods(http.MethodGet)
@ -837,7 +837,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// - application/json // - application/json
// responses: // responses:
// 200: // 200:
// $ref: "#/responses/DockerImageSummary" // $ref: "#/responses/LibpodImageSummaryResponse"
// 500: // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/json"), s.APIHandler(libpod.GetImages)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/images/json"), s.APIHandler(libpod.GetImages)).Methods(http.MethodGet)

View File

@ -6,6 +6,7 @@ import (
"github.com/containers/podman/v3/pkg/domain/entities" "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/domain/entities/reports" "github.com/containers/podman/v3/pkg/domain/entities/reports"
"github.com/containers/podman/v3/pkg/errorhandling" "github.com/containers/podman/v3/pkg/errorhandling"
docker "github.com/docker/docker/api/types"
) )
// No such image // No such image
@ -134,9 +135,16 @@ type swagPodAlreadyStopped struct {
} }
} }
// Image summary // Image summary for compat API
// swagger:response DockerImageSummary // swagger:response DockerImageSummaryResponse
type swagImageSummary struct { type swagDockerImageSummaryResponse struct {
// in:body
Body []docker.ImageSummary
}
// Image summary for libpod API
// swagger:response LibpodImageSummaryResponse
type swagLibpodImageSummaryResponse struct {
// in:body // in:body
Body []entities.ImageSummary Body []entities.ImageSummary
} }

View File

@ -50,6 +50,7 @@ func (i *Image) Id() string { // nolint
return i.ID return i.ID
} }
// swagger:model LibpodImageSummary
type ImageSummary struct { type ImageSummary struct {
ID string `json:"Id"` ID string `json:"Id"`
ParentId string // nolint ParentId string // nolint