From 5029a3f0ebc59f5c5146763f2dc45ea7f8224ba4 Mon Sep 17 00:00:00 2001 From: Chris Arceneaux Date: Tue, 27 Apr 2021 16:11:54 -0400 Subject: [PATCH] Updated response code for credential creation swagger.yml reported response code 201 when it should've been 200. Signed-off-by: Chris Arceneaux --- Makefile | 2 +- client/credentials/create_creds_responses.go | 22 ++++++++++---------- client/credentials/credentials_client.go | 6 +++--- swagger.yml | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 6b58668..27f9be8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: generate dependency +default: generate dependency # Removes currently generated client files cleanup: diff --git a/client/credentials/create_creds_responses.go b/client/credentials/create_creds_responses.go index aee2f9a..6034517 100644 --- a/client/credentials/create_creds_responses.go +++ b/client/credentials/create_creds_responses.go @@ -23,8 +23,8 @@ type CreateCredsReader struct { // ReadResponse reads a server response into the received o. func (o *CreateCredsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 201: - result := NewCreateCredsCreated() + case 200: + result := NewCreateCredsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } @@ -58,27 +58,27 @@ func (o *CreateCredsReader) ReadResponse(response runtime.ClientResponse, consum } } -// NewCreateCredsCreated creates a CreateCredsCreated with default headers values -func NewCreateCredsCreated() *CreateCredsCreated { - return &CreateCredsCreated{} +// NewCreateCredsOK creates a CreateCredsOK with default headers values +func NewCreateCredsOK() *CreateCredsOK { + return &CreateCredsOK{} } -/* CreateCredsCreated describes a response with status code 201, with default header values. +/* CreateCredsOK describes a response with status code 200, with default header values. Account has been added. */ -type CreateCredsCreated struct { +type CreateCredsOK struct { Payload *models.CredentialsModel } -func (o *CreateCredsCreated) Error() string { - return fmt.Sprintf("[POST /api/v1/credentials][%d] createCredsCreated %+v", 201, o.Payload) +func (o *CreateCredsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/credentials][%d] createCredsOK %+v", 200, o.Payload) } -func (o *CreateCredsCreated) GetPayload() *models.CredentialsModel { +func (o *CreateCredsOK) GetPayload() *models.CredentialsModel { return o.Payload } -func (o *CreateCredsCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { +func (o *CreateCredsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.CredentialsModel) diff --git a/client/credentials/credentials_client.go b/client/credentials/credentials_client.go index 71c0dce..77d3158 100644 --- a/client/credentials/credentials_client.go +++ b/client/credentials/credentials_client.go @@ -36,7 +36,7 @@ type ClientService interface { ChangeRootPasswordForCreds(params *ChangeRootPasswordForCredsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ChangeRootPasswordForCredsOK, error) - CreateCreds(params *CreateCredsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCredsCreated, error) + CreateCreds(params *CreateCredsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCredsOK, error) DeleteCreds(params *DeleteCredsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCredsNoContent, error) @@ -177,7 +177,7 @@ func (a *Client) ChangeRootPasswordForCreds(params *ChangeRootPasswordForCredsPa The HTTP POST request to the `/api/v1/credentials` path allows you to add a credentials record. */ -func (a *Client) CreateCreds(params *CreateCredsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCredsCreated, error) { +func (a *Client) CreateCreds(params *CreateCredsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCredsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewCreateCredsParams() @@ -203,7 +203,7 @@ func (a *Client) CreateCreds(params *CreateCredsParams, authInfo runtime.ClientA if err != nil { return nil, err } - success, ok := result.(*CreateCredsCreated) + success, ok := result.(*CreateCredsOK) if ok { return success, nil } diff --git a/swagger.yml b/swagger.yml index e6552d2..04eea34 100644 --- a/swagger.yml +++ b/swagger.yml @@ -3744,7 +3744,7 @@ paths: schema: $ref: '#/definitions/CredentialsSpec' responses: - '201': + '200': description: Account has been added. schema: $ref: '#/definitions/CredentialsModel'