fix incorrect swagger doc for network dis/connect

The swagger api docs used the extra Body struct as part of the request
which is wrong. We just want the plain type.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2021-12-08 18:19:43 +01:00
parent 4791595b5c
commit 46938bbf88
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
3 changed files with 13 additions and 9 deletions

View File

@ -55,15 +55,13 @@ type swagCompatNetworkCreateResponse struct {
} }
// Network disconnect // Network disconnect
// swagger:model NetworkConnectRequest // swagger:model NetworkCompatConnectRequest
type swagCompatNetworkConnectRequest struct { type swagCompatNetworkConnectRequest struct {
// in:body types.NetworkConnect
Body struct{ types.NetworkConnect }
} }
// Network disconnect // Network disconnect
// swagger:model NetworkDisconnectRequest // swagger:model NetworkCompatDisconnectRequest
type swagCompatNetworkDisconnectRequest struct { type swagCompatNetworkDisconnectRequest struct {
// in:body types.NetworkDisconnect
Body struct{ types.NetworkDisconnect }
} }

View File

@ -133,6 +133,12 @@ type swagNetworkPruneResponse struct {
Body []entities.NetworkPruneReport Body []entities.NetworkPruneReport
} }
// Network connect
// swagger:model NetworkConnectRequest
type swagNetworkConnectRequest struct {
entities.NetworkConnectOptions
}
func ServeSwagger(w http.ResponseWriter, r *http.Request) { func ServeSwagger(w http.ResponseWriter, r *http.Request) {
path := DefaultPodmanSwaggerSpec path := DefaultPodmanSwaggerSpec
if p, found := os.LookupEnv("PODMAN_SWAGGER_SPEC"); found { if p, found := os.LookupEnv("PODMAN_SWAGGER_SPEC"); found {

View File

@ -131,7 +131,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error {
// name: create // name: create
// description: attributes for connecting a container to a network // description: attributes for connecting a container to a network
// schema: // schema:
// $ref: "#/definitions/NetworkConnectRequest" // $ref: "#/definitions/NetworkCompatConnectRequest"
// responses: // responses:
// 200: // 200:
// description: OK // description: OK
@ -159,7 +159,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error {
// name: create // name: create
// description: attributes for disconnecting a container from a network // description: attributes for disconnecting a container from a network
// schema: // schema:
// $ref: "#/definitions/NetworkDisconnectRequest" // $ref: "#/definitions/NetworkCompatDisconnectRequest"
// responses: // responses:
// 200: // 200:
// description: OK // description: OK
@ -368,7 +368,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error {
// name: create // name: create
// description: attributes for disconnecting a container from a network // description: attributes for disconnecting a container from a network
// schema: // schema:
// $ref: "#/definitions/NetworkDisconnectRequest" // $ref: "#/definitions/NetworkCompatDisconnectRequest"
// responses: // responses:
// 200: // 200:
// description: OK // description: OK