Skip to content

Commit

Permalink
api: swagger: move ContainerWaitResponse to definitions
Browse files Browse the repository at this point in the history
This should help with CI being unstable when generating the types (due
to Go randomizing order). Unfortunately, the (file) names are a bit ugly,
but addressing that in a follow-up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Mar 5, 2022
1 parent 444b279 commit e4c6ca3
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 45 deletions.
40 changes: 24 additions & 16 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4460,6 +4460,29 @@ definitions:
Health:
$ref: "#/definitions/Health"

ContainerWaitResponse:
description: "OK response to ContainerWait operation"
type: "object"
x-go-name: "ContainerWaitOKBody"
title: "ContainerWaitResponse"
required: [StatusCode, Error]
properties:
StatusCode:
description: "Exit code of the container"
type: "integer"
x-nullable: false
Error:
$ref: "#/definitions/ContainerWaitExitError"

ContainerWaitExitError:
description: "container waiting error, if any"
type: "object"
x-go-name: "ContainerWaitOKBodyError"
properties:
Message:
description: "Details of an error"
type: "string"

SystemVersion:
type: "object"
description: |
Expand Down Expand Up @@ -7192,22 +7215,7 @@ paths:
200:
description: "The container has exit."
schema:
type: "object"
title: "ContainerWaitResponse"
description: "OK response to ContainerWait operation"
required: [StatusCode]
properties:
StatusCode:
description: "Exit code of the container"
type: "integer"
x-nullable: false
Error:
description: "container waiting error, if any"
type: "object"
properties:
Message:
description: "Details of an error"
type: "string"
$ref: "#/definitions/ContainerWaitResponse"
400:
description: "bad parameter"
schema:
Expand Down
28 changes: 0 additions & 28 deletions api/types/container/container_wait.go

This file was deleted.

19 changes: 19 additions & 0 deletions api/types/container/container_wait_o_k_body.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package container

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

// ContainerWaitOKBody ContainerWaitResponse
//
// OK response to ContainerWait operation
// swagger:model ContainerWaitOKBody
type ContainerWaitOKBody struct {

// error
// Required: true
Error *ContainerWaitOKBodyError `json:"Error"`

// Exit code of the container
// Required: true
StatusCode int64 `json:"StatusCode"`
}
12 changes: 12 additions & 0 deletions api/types/container/container_wait_o_k_body_error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package container

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

// ContainerWaitOKBodyError container waiting error, if any
// swagger:model ContainerWaitOKBodyError
type ContainerWaitOKBodyError struct {

// Details of an error
Message string `json:"Message,omitempty"`
}
6 changes: 5 additions & 1 deletion hack/generate-swagger-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ swagger generate model -f api/swagger.yaml \
-n ServiceUpdateResponse \
-n Volume

swagger generate model -f api/swagger.yaml \
-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
-n ContainerWaitResponse \
-n ContainerWaitExitError

swagger generate model -f api/swagger.yaml \
-t api -m types/volume --skip-validator -C api/swagger-gen.yaml \
-n VolumeCreateOptions
Expand All @@ -25,6 +30,5 @@ swagger generate operation -f api/swagger.yaml \
-n ContainerCreate \
-n ContainerTop \
-n ContainerUpdate \
-n ContainerWait \
-n ImageHistory \
-n VolumeList

0 comments on commit e4c6ca3

Please sign in to comment.