From 74cb739766e517115c5af9cee2202613661238a0 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 24 Nov 2017 11:02:55 +0100 Subject: [PATCH 1/3] schema is missing CanRemove & DetachKeys example demonstrates they are expected Signed-off-by: Nicolas De Loof --- api/swagger.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/swagger.yaml b/api/swagger.yaml index a6b5ee5cfd..34f130a5c9 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -7367,6 +7367,10 @@ paths: schema: type: "object" properties: + CanRemove: + type: "boolean" + DetachKeys: + type: "string" ID: type: "string" Running: From d6935a8f1a4003c0b6f1b89a0e28e721d0756ac9 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 24 Nov 2017 11:40:53 +0100 Subject: [PATCH 2/3] duplicate definitions for API response with just an ID Signed-off-by: Nicolas De Loof --- api/swagger.yaml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/api/swagger.yaml b/api/swagger.yaml index 34f130a5c9..bb15ad5b5f 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -9512,13 +9512,7 @@ paths: 201: description: "no error" schema: - type: "object" - properties: - ID: - description: "The ID of the created secret." - type: "string" - example: - ID: "ktnbjxoalbkvbvedmg1urrz8h" + $ref: "#/definitions/IdResponse" 409: description: "name conflicts with an existing object" schema: @@ -9717,13 +9711,7 @@ paths: 201: description: "no error" schema: - type: "object" - properties: - ID: - description: "The ID of the created config." - type: "string" - example: - ID: "ktnbjxoalbkvbvedmg1urrz8h" + $ref: "#/definitions/IdResponse" 409: description: "name conflicts with an existing object" schema: From 8e7f9afa471c2be079f2c8897cf3b87e7f60544e Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 24 Nov 2017 11:41:57 +0100 Subject: [PATCH 3/3] =?UTF-8?q?use=20swagger=20support=20for=20=C2=AB?= =?UTF-8?q?=C2=A0title=C2=A0=C2=BB=20as=20generated=20types=20names=20for?= =?UTF-8?q?=20inline=20schema=20align=20naming=20convention=20with=20x-go-?= =?UTF-8?q?name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas De Loof --- api/swagger.yaml | 30 ++++++++++++++++++++++++ api/templates/server/operation.gotmpl | 2 +- api/types/container/container_changes.go | 2 +- api/types/container/container_create.go | 2 +- api/types/container/container_top.go | 2 +- api/types/container/container_update.go | 2 +- api/types/container/container_wait.go | 2 +- api/types/image/image_history.go | 2 +- 8 files changed, 37 insertions(+), 7 deletions(-) diff --git a/api/swagger.yaml b/api/swagger.yaml index bb15ad5b5f..5d3abe0ea4 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -4501,6 +4501,8 @@ paths: description: "Container created successfully" schema: type: "object" + title: "ContainerCreateResponse" + description: "OK response to ContainerCreate operation" required: [Id, Warnings] properties: Id: @@ -4549,6 +4551,7 @@ paths: description: "no error" schema: type: "object" + title: "ContainerInspectResponse" properties: Id: description: "The ID of the container" @@ -4833,6 +4836,8 @@ paths: description: "no error" schema: type: "object" + title: "ContainerTopResponse" + description: "OK response to ContainerTop operation" properties: Titles: description: "The ps column titles" @@ -4993,6 +4998,8 @@ paths: items: type: "object" x-go-name: "ContainerChangeResponseItem" + title: "ContainerChangeResponseItem" + description: "change item in response to ContainerChanges operation" required: [Path, Kind] properties: Path: @@ -5371,6 +5378,8 @@ paths: description: "The container has been updated." schema: type: "object" + title: "ContainerUpdateResponse" + description: "OK response to ContainerUpdate operation" properties: Warnings: type: "array" @@ -5724,6 +5733,8 @@ paths: description: "The container has exit." schema: type: "object" + title: "ContainerWaitResponse" + description: "OK response to ContainerWait operation" required: [StatusCode] properties: StatusCode: @@ -5969,6 +5980,7 @@ paths: description: "No error" schema: type: "object" + title: "ContainerPruneResponse" properties: ContainersDeleted: description: "Container IDs that were deleted" @@ -6225,6 +6237,7 @@ paths: description: "No error" schema: type: "object" + title: "BuildPruneResponse" properties: SpaceReclaimed: description: "Disk space reclaimed in bytes" @@ -6410,6 +6423,8 @@ paths: items: type: "object" x-go-name: HistoryResponseItem + title: "HistoryResponseItem" + description: "individual image layer information in response to ImageHistory operation" required: [Id, Created, CreatedBy, Tags, Size, Comment] properties: Id: @@ -6616,6 +6631,7 @@ paths: type: "array" items: type: "object" + title: "ImageSearchResponseItem" properties: description: type: "string" @@ -6691,6 +6707,7 @@ paths: description: "No error" schema: type: "object" + title: "ImagePruneResponse" properties: ImagesDeleted: description: "Images that were deleted" @@ -6718,6 +6735,7 @@ paths: description: "An identity token was generated successfully." schema: type: "object" + title: "SystemAuthResponse" required: [Status] properties: Status: @@ -6772,6 +6790,7 @@ paths: description: "no error" schema: type: "object" + title: "SystemVersionResponse" properties: Version: type: "string" @@ -6928,6 +6947,7 @@ paths: description: "no error" schema: type: "object" + title: "SystemEventsResponse" properties: Type: description: "The type of object emitting the event" @@ -7011,6 +7031,7 @@ paths: description: "no error" schema: type: "object" + title: "SystemDataUsageResponse" properties: LayersSize: type: "integer" @@ -7366,6 +7387,7 @@ paths: description: "No error" schema: type: "object" + title: "ExecInspectResponse" properties: CanRemove: type: "boolean" @@ -7436,6 +7458,7 @@ paths: description: "Summary volume data that matches the query" schema: type: "object" + title: "VolumeListResponse" required: [Volumes, Warnings] properties: Volumes: @@ -7617,6 +7640,7 @@ paths: description: "No error" schema: type: "object" + title: "VolumePruneResponse" properties: VolumesDeleted: description: "Volumes that were deleted" @@ -7795,6 +7819,7 @@ paths: description: "No error" schema: type: "object" + title: "NetworkCreateResponse" properties: Id: description: "The ID of the created network." @@ -7997,6 +8022,7 @@ paths: description: "No error" schema: type: "object" + title: "NetworkPruneResponse" properties: NetworksDeleted: description: "Networks that were deleted" @@ -8048,6 +8074,7 @@ paths: items: description: "Describes a permission the user has to accept upon installing the plugin." type: "object" + title: "PluginPrivilegeItem" properties: Name: type: "string" @@ -8750,6 +8777,7 @@ paths: description: "no error" schema: type: "object" + title: "UnlockKeyResponse" properties: UnlockKey: description: "The swarm's unlock key." @@ -8841,6 +8869,7 @@ paths: description: "no error" schema: type: "object" + title: "ServiceCreateResponse" properties: ID: description: "The ID of the created service." @@ -9857,6 +9886,7 @@ paths: schema: type: "object" x-go-name: DistributionInspect + title: "DistributionInspectResponse" required: [Descriptor, Platforms] properties: Descriptor: diff --git a/api/templates/server/operation.gotmpl b/api/templates/server/operation.gotmpl index 3ff63ef94c..8bed59d920 100644 --- a/api/templates/server/operation.gotmpl +++ b/api/templates/server/operation.gotmpl @@ -20,7 +20,7 @@ import ( {{ range .ExtraSchemas }} -// {{ .Name }} {{ template "docstring" . }} +// {{ .Name }} {{ comment .Description }} // swagger:model {{ .Name }} {{ template "schema" . }} {{ end }} diff --git a/api/types/container/container_changes.go b/api/types/container/container_changes.go index 767945a532..c909d6ca3e 100644 --- a/api/types/container/container_changes.go +++ b/api/types/container/container_changes.go @@ -7,7 +7,7 @@ package container // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- -// ContainerChangeResponseItem container change response item +// ContainerChangeResponseItem change item in response to ContainerChanges operation // swagger:model ContainerChangeResponseItem type ContainerChangeResponseItem struct { diff --git a/api/types/container/container_create.go b/api/types/container/container_create.go index c95023b814..49efa0f2c0 100644 --- a/api/types/container/container_create.go +++ b/api/types/container/container_create.go @@ -7,7 +7,7 @@ package container // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- -// ContainerCreateCreatedBody container create created body +// ContainerCreateCreatedBody OK response to ContainerCreate operation // swagger:model ContainerCreateCreatedBody type ContainerCreateCreatedBody struct { diff --git a/api/types/container/container_top.go b/api/types/container/container_top.go index 78bc37ee5e..ba41edcf3f 100644 --- a/api/types/container/container_top.go +++ b/api/types/container/container_top.go @@ -7,7 +7,7 @@ package container // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- -// ContainerTopOKBody container top o k body +// ContainerTopOKBody OK response to ContainerTop operation // swagger:model ContainerTopOKBody type ContainerTopOKBody struct { diff --git a/api/types/container/container_update.go b/api/types/container/container_update.go index 2339366fbd..7630ae54cd 100644 --- a/api/types/container/container_update.go +++ b/api/types/container/container_update.go @@ -7,7 +7,7 @@ package container // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- -// ContainerUpdateOKBody container update o k body +// ContainerUpdateOKBody OK response to ContainerUpdate operation // swagger:model ContainerUpdateOKBody type ContainerUpdateOKBody struct { diff --git a/api/types/container/container_wait.go b/api/types/container/container_wait.go index 47fb17578a..9e3910a6b4 100644 --- a/api/types/container/container_wait.go +++ b/api/types/container/container_wait.go @@ -15,7 +15,7 @@ type ContainerWaitOKBodyError struct { Message string `json:"Message,omitempty"` } -// ContainerWaitOKBody container wait o k body +// ContainerWaitOKBody OK response to ContainerWait operation // swagger:model ContainerWaitOKBody type ContainerWaitOKBody struct { diff --git a/api/types/image/image_history.go b/api/types/image/image_history.go index 0dd30c729a..d6b354bcdf 100644 --- a/api/types/image/image_history.go +++ b/api/types/image/image_history.go @@ -7,7 +7,7 @@ package image // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- -// HistoryResponseItem history response item +// HistoryResponseItem individual image layer information in response to ImageHistory operation // swagger:model HistoryResponseItem type HistoryResponseItem struct {