From cd635e465d05e37c42b2a4db4ecb1a93af8e7ea0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 5 Mar 2022 15:14:27 +0100 Subject: [PATCH] api: swagger: move VolumeListResponse to definitions Signed-off-by: Sebastiaan van Stijn --- api/swagger.yaml | 38 +++++++++++++----------- api/types/volume/volume_list.go | 23 -------------- api/types/volume/volume_list_o_k_body.go | 18 +++++++++++ hack/generate-swagger-api.sh | 6 ++-- 4 files changed, 41 insertions(+), 44 deletions(-) delete mode 100644 api/types/volume/volume_list.go create mode 100644 api/types/volume/volume_list_o_k_body.go diff --git a/api/swagger.yaml b/api/swagger.yaml index 50ef73c065..8554f90022 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -2069,6 +2069,25 @@ definitions: com.example.some-label: "some-value" com.example.some-other-label: "some-other-value" + VolumeListResponse: + type: "object" + title: "VolumeListResponse" + x-go-name: "VolumeListOKBody" + description: "Volume list response" + properties: + Volumes: + type: "array" + description: "List of volumes" + items: + $ref: "#/definitions/Volume" + Warnings: + type: "array" + description: | + Warnings that occurred when fetching the list of volumes. + items: + type: "string" + example: [] + Network: type: "object" properties: @@ -9145,24 +9164,7 @@ paths: 200: description: "Summary volume data that matches the query" schema: - type: "object" - title: "VolumeListResponse" - description: "Volume list response" - required: [Volumes, Warnings] - properties: - Volumes: - type: "array" - x-nullable: false - description: "List of volumes" - items: - $ref: "#/definitions/Volume" - Warnings: - type: "array" - x-nullable: false - description: | - Warnings that occurred when fetching the list of volumes. - items: - type: "string" + $ref: "#/definitions/VolumeListResponse" 500: description: "Server error" schema: diff --git a/api/types/volume/volume_list.go b/api/types/volume/volume_list.go deleted file mode 100644 index be06179bf4..0000000000 --- a/api/types/volume/volume_list.go +++ /dev/null @@ -1,23 +0,0 @@ -package volume // import "github.com/docker/docker/api/types/volume" - -// ---------------------------------------------------------------------------- -// Code generated by `swagger generate operation`. DO NOT EDIT. -// -// See hack/generate-swagger-api.sh -// ---------------------------------------------------------------------------- - -import "github.com/docker/docker/api/types" - -// VolumeListOKBody Volume list response -// swagger:model VolumeListOKBody -type VolumeListOKBody struct { - - // List of volumes - // Required: true - Volumes []*types.Volume `json:"Volumes"` - - // Warnings that occurred when fetching the list of volumes. - // - // Required: true - Warnings []string `json:"Warnings"` -} diff --git a/api/types/volume/volume_list_o_k_body.go b/api/types/volume/volume_list_o_k_body.go new file mode 100644 index 0000000000..66dd12ec28 --- /dev/null +++ b/api/types/volume/volume_list_o_k_body.go @@ -0,0 +1,18 @@ +package volume + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// VolumeListOKBody VolumeListResponse +// +// Volume list response +// swagger:model VolumeListOKBody +type VolumeListOKBody struct { + + // List of volumes + Volumes []*Volume `json:"Volumes"` + + // Warnings that occurred when fetching the list of volumes. + // + Warnings []string `json:"Warnings"` +} diff --git a/hack/generate-swagger-api.sh b/hack/generate-swagger-api.sh index d9be64c264..95a0bf103e 100755 --- a/hack/generate-swagger-api.sh +++ b/hack/generate-swagger-api.sh @@ -24,7 +24,8 @@ swagger generate model -f api/swagger.yaml \ swagger generate model -f api/swagger.yaml \ -t api -m types/volume --skip-validator -C api/swagger-gen.yaml \ -n Volume \ - -n VolumeCreateOptions + -n VolumeCreateOptions \ + -n VolumeListResponse swagger generate operation -f api/swagger.yaml \ -t api -a types -m types -C api/swagger-gen.yaml \ @@ -34,5 +35,4 @@ swagger generate operation -f api/swagger.yaml \ -n ContainerCreate \ -n ContainerTop \ -n ContainerUpdate \ - -n ImageHistory \ - -n VolumeList + -n ImageHistory