diff options
author | Ed Santiago <santiago@redhat.com> | 2020-02-17 07:23:55 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2020-02-18 11:07:07 -0700 |
commit | 2a411bcbfa3dc72d3a8cb35c2d1004ab05e4e0e8 (patch) | |
tree | 9de509509ef6012863bc10415e037aa239cec83c /pkg/api/server/register_images.go | |
parent | a5d55966bde3b0798f9cb89009d443ccfac3126a (diff) | |
download | podman-2a411bcbfa3dc72d3a8cb35c2d1004ab05e4e0e8.tar.gz podman-2a411bcbfa3dc72d3a8cb35c2d1004ab05e4e0e8.tar.bz2 podman-2a411bcbfa3dc72d3a8cb35c2d1004ab05e4e0e8.zip |
Swagger: fix inconsistencies (try #2)
As I've mentioned once or twice, hand-maintained swagger docs
are evil. This commit attempts to fix:
* Inconsistent methods (swagger says POST but code signature
says GET)
* Inconsistent capitalization
* Typos ("Mounter", "pood")
* Completely wrong paths (/inspect vs /json)
* Missing .Method() registrations
* Missing /libpod in some /volumes paths
* Incorrect method declaration: /libpod/containers/.../kill
was correct (POST) in swagger but wrong in the code itself
(http.MethodGet). Correct the latter to MethodPost
This is two hours' work, even with a script I have that
tries to cross-check everything.
Swagger docs should not be human-maintained.
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'pkg/api/server/register_images.go')
-rw-r--r-- | pkg/api/server/register_images.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 923a1f266..5b9ac7952 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -264,7 +264,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // $ref: "#/responses/NoSuchImage" // 500: // $ref: "#/responses/InternalError" - r.Handle(VersionedPath("/images/{name:.*}/json"), s.APIHandler(generic.GetImage)) + r.Handle(VersionedPath("/images/{name:.*}/json"), s.APIHandler(generic.GetImage)).Methods(http.MethodGet) // swagger:operation POST /images/{name:.*}/tag compat tagImage // --- // tags: @@ -299,7 +299,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // 500: // $ref: '#/responses/InternalError' r.Handle(VersionedPath("/images/{name:.*}/tag"), s.APIHandler(handlers.TagImage)).Methods(http.MethodPost) - // swagger:operation POST /commit/ compat commitContainer + // swagger:operation POST /commit compat commitContainer // --- // tags: // - containers (compat) @@ -345,7 +345,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // $ref: '#/responses/InternalError' r.Handle(VersionedPath("/commit"), s.APIHandler(generic.CommitContainer)).Methods(http.MethodPost) - // swagger:operation POST /build images buildImage + // swagger:operation POST /build compat buildImage // --- // tags: // - images @@ -558,7 +558,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { libpod endpoints */ - // swagger:operation POST /libpod/images/{name:.*}/exists libpod libpodImageExists + // swagger:operation GET /libpod/images/{name:.*}/exists libpod libpodImageExists // --- // tags: // - images @@ -579,8 +579,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // $ref: '#/responses/NoSuchImage' // 500: // $ref: '#/responses/InternalError' - r.Handle(VersionedPath("/libpod/images/{name:.*}/exists"), s.APIHandler(libpod.ImageExists)) - // swagger:operation POST /libpod/images/{name:.*}/tree libpod libpodImageTree + r.Handle(VersionedPath("/libpod/images/{name:.*}/exists"), s.APIHandler(libpod.ImageExists)).Methods(http.MethodGet) + // swagger:operation GET /libpod/images/{name:.*}/tree libpod libpodImageTree // --- // tags: // - images @@ -605,7 +605,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // $ref: '#/responses/NoSuchImage' // 500: // $ref: '#/responses/InternalError' - r.Handle(VersionedPath("/libpod/images/{name:.*}/tree"), s.APIHandler(libpod.ImageTree)) + r.Handle(VersionedPath("/libpod/images/{name:.*}/tree"), s.APIHandler(libpod.ImageTree)).Methods(http.MethodGet) // swagger:operation GET /libpod/images/{name:.*}/history libpod libpodImageHistory // --- // tags: @@ -852,7 +852,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // 500: // $ref: '#/responses/InternalError' r.Handle(VersionedPath("/libpod/images/{name:.*}"), s.APIHandler(handlers.RemoveImage)).Methods(http.MethodDelete) - // swagger:operation GET /libpod/images/{name:.*}/get libpod libpoodExportImage + // swagger:operation GET /libpod/images/{name:.*}/get libpod libpodExportImage // --- // tags: // - images @@ -906,7 +906,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // $ref: '#/responses/NoSuchImage' // 500: // $ref: '#/responses/InternalError' - r.Handle(VersionedPath("/libpod/images/{name:.*}/json"), s.APIHandler(libpod.GetImage)) + r.Handle(VersionedPath("/libpod/images/{name:.*}/json"), s.APIHandler(libpod.GetImage)).Methods(http.MethodGet) // swagger:operation POST /libpod/images/{name:.*}/tag libpod libpodTagImage // --- // tags: |