[NO TESTS NEEDED] Clean up swagger

* Removed defined by unused responses
* Added missing body definitions
* Updated header input definitions

Outstanding issues:
* Supporting body ContainerConfig for /commit endpoint

Fixes #8577

Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
Jhon Honce
2021-08-18 16:27:20 -07:00
parent 5a32946d61
commit 0897946f60
7 changed files with 36 additions and 41 deletions

View File

@ -2,7 +2,6 @@ package compat
import ( import (
"github.com/containers/podman/v3/pkg/domain/entities" "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/storage/pkg/archive"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
) )
@ -28,15 +27,6 @@ type swagCtrWaitResponse struct {
} }
} }
// Object Changes
// swagger:response Changes
type swagChangesResponse struct {
// in:body
Body struct {
Changes []archive.Change
}
}
// Network inspect // Network inspect
// swagger:response CompatNetworkInspect // swagger:response CompatNetworkInspect
type swagCompatNetworkInspect struct { type swagCompatNetworkInspect struct {

View File

@ -152,13 +152,6 @@ type swagPodTopResponse struct {
} }
} }
// List processes in pod
// swagger:response DocsPodStatsResponse
type swagPodStatsResponse struct {
// in:body
Body []*entities.PodStatsReport
}
// Inspect container // Inspect container
// swagger:response LibpodInspectContainerResponse // swagger:response LibpodInspectContainerResponse
type swagLibpodInspectContainerResponse struct { type swagLibpodInspectContainerResponse struct {
@ -183,12 +176,3 @@ type swagInspectPodResponse struct {
define.InspectPodData define.InspectPodData
} }
} }
// Inspect volume
// swagger:response InspectVolumeResponse
type swagInspectVolumeResponse struct {
// in:body
Body struct {
define.InspectVolumeData
}
}

View File

@ -104,6 +104,7 @@ type ContainerWaitOKBody struct {
} }
// CreateContainerConfig used when compatible endpoint creates a container // CreateContainerConfig used when compatible endpoint creates a container
// swagger:model CreateContainerConfig
type CreateContainerConfig struct { type CreateContainerConfig struct {
Name string // container name Name string // container name
dockerContainer.Config // desired container configuration dockerContainer.Config // desired container configuration

View File

@ -21,6 +21,12 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// name: name // name: name
// type: string // type: string
// description: container name // description: container name
// - in: body
// name: body
// description: Container to create
// schema:
// $ref: "#/definitions/CreateContainerConfig"
// required: true
// responses: // responses:
// 201: // 201:
// $ref: "#/responses/ContainerCreateResponse" // $ref: "#/responses/ContainerCreateResponse"

View File

@ -25,6 +25,10 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: header
// name: X-Registry-Auth
// type: string
// description: A base64-encoded auth configuration.
// - in: query // - in: query
// name: fromImage // name: fromImage
// type: string // type: string
@ -49,13 +53,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// name: platform // name: platform
// type: string // type: string
// description: Platform in the format os[/arch[/variant]] // description: Platform in the format os[/arch[/variant]]
// default: ""
// - in: header
// name: X-Registry-Auth
// type: string
// description: A base64-encoded auth configuration.
// - in: body // - in: body
// name: request // name: inputImage
// schema: // schema:
// type: string // type: string
// format: binary // format: binary
@ -472,6 +471,14 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// summary: Create image // summary: Create image
// description: Build an image from the given Dockerfile(s) // description: Build an image from the given Dockerfile(s)
// parameters: // parameters:
// - in: header
// name: Content-Type
// type: string
// default: application/x-tar
// enum: ["application/x-tar"]
// - in: header
// name: X-Registry-Config
// type: string
// - in: query // - in: query
// name: dockerfile // name: dockerfile
// type: string // type: string
@ -653,6 +660,14 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: | // description: |
// output configuration TBD // output configuration TBD
// (As of version 1.xx) // (As of version 1.xx)
// - in: body
// name: inputStream
// description: |
// A tar archive compressed with one of the following algorithms:
// identity (no compression), gzip, bzip2, xz.
// schema:
// type: string
// format: binary
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
@ -852,6 +867,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// summary: Import image // summary: Import image
// description: Import a previously exported tarball as an image. // description: Import a previously exported tarball as an image.
// parameters: // parameters:
// - in: header
// name: Content-Type
// type: string
// default: application/x-tar
// enum: ["application/x-tar"]
// - in: query // - in: query
// name: changes // name: changes
// description: "Apply the following possible instructions to the created image: CMD | ENTRYPOINT | ENV | EXPOSE | LABEL | STOPSIGNAL | USER | VOLUME | WORKDIR. JSON encoded string" // description: "Apply the following possible instructions to the created image: CMD | ENTRYPOINT | ENV | EXPOSE | LABEL | STOPSIGNAL | USER | VOLUME | WORKDIR. JSON encoded string"
@ -875,7 +895,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// required: true // required: true
// description: tarball for imported image // description: tarball for imported image
// schema: // schema:
// type: "string" // type: string
// format: binary
// produces: // produces:
// - application/json // - application/json
// consumes: // consumes:

View File

@ -51,7 +51,7 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// responses: // responses:
// 201: // 201:
// schema: // schema:
// $ref: "#/definitions/IdResponse" // $ref: "#/definitions/IDResponse"
// 400: // 400:
// $ref: "#/responses/BadParamError" // $ref: "#/responses/BadParamError"
// 409: // 409:

View File

@ -141,13 +141,6 @@ type swagImageSummary struct {
Body []entities.ImageSummary Body []entities.ImageSummary
} }
// Registries summary
// swagger:response DocsRegistriesList
type swagRegistriesList struct {
// in:body
Body entities.ListRegistriesReport
}
// List Containers // List Containers
// swagger:response DocsListContainer // swagger:response DocsListContainer
type swagListContainers struct { type swagListContainers struct {