Skip to content

Commit

Permalink
Merge pull request containers#10365 from jwhonce/issues/9578
Browse files Browse the repository at this point in the history
Match swagger to "as built" output
  • Loading branch information
openshift-merge-robot authored May 21, 2021
2 parents 7f4afe4 + 8bf852d commit 490915c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
18 changes: 9 additions & 9 deletions pkg/api/handlers/swagger/swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import (
"github.com/docker/docker/api/types"
)

// Tree response
// swagger:response TreeResponse
type swagTree struct {
// in:body
Body struct {
entities.ImageTreeReport
}
}

// History response
// swagger:response DocsHistory
type swagHistory struct {
Expand Down Expand Up @@ -183,12 +192,3 @@ type swagInspectVolumeResponse struct {
define.InspectVolumeData
}
}

// Image tree response
// swagger:response LibpodImageTreeResponse
type swagImageTreeResponse struct {
// in:body
Body struct {
handlers.ImageTreeResponse
}
}
9 changes: 0 additions & 9 deletions pkg/api/handlers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,6 @@ type HistoryResponse struct {
Comment string
}

type ImageLayer struct{}

type ImageTreeResponse struct {
ID string `json:"id"`
Tags []string `json:"tags"`
Size string `json:"size"`
Layers []ImageLayer `json:"layers"`
}

type ExecCreateConfig struct {
docker.ExecConfig
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/server/register_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// - application/json
// responses:
// 200:
// $ref: '#/responses/LibpodImageTreeResponse'
// $ref: "#/responses/TreeResponse"
// 404:
// $ref: '#/responses/NoSuchImage'
// 500:
Expand Down
6 changes: 6 additions & 0 deletions test/apiv2/python/rest_api/test_v2_0_0_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ def test_history(self):
for k in required_keys:
self.assertIn(k, change)

def test_tree(self):
r = requests.get(self.uri("/images/alpine/tree"))
self.assertEqual(r.status_code, 200, r.text)
tree = r.json()
self.assertTrue(tree["Tree"].startswith("Image ID:"), r.text)


if __name__ == "__main__":
unittest.main()

0 comments on commit 490915c

Please sign in to comment.