From c6422b49b8b946386ca1068ec6887bbf07a8b166 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 10 May 2018 17:10:19 -0700 Subject: 404 example --- golang/gen/restapi/embedded_spec.go | 28 +++++++++++++- .../restapi/operations/get_creator_id_responses.go | 44 ++++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) (limited to 'golang/gen/restapi') diff --git a/golang/gen/restapi/embedded_spec.go b/golang/gen/restapi/embedded_spec.go index 6a6cf356..4e08594f 100644 --- a/golang/gen/restapi/embedded_spec.go +++ b/golang/gen/restapi/embedded_spec.go @@ -72,6 +72,12 @@ func init() { "$ref": "#/definitions/creator_entity" } }, + "404": { + "description": "no such creator", + "schema": { + "$ref": "#/definitions/error" + } + }, "default": { "description": "generic error response", "schema": { @@ -114,7 +120,13 @@ func init() { "type": "string" }, "state": { - "type": "string" + "type": "string", + "enum": [ + "wip", + "active", + "redirect", + "deleted" + ] } } }, @@ -186,6 +198,12 @@ func init() { "$ref": "#/definitions/creator_entity" } }, + "404": { + "description": "no such creator", + "schema": { + "$ref": "#/definitions/error" + } + }, "default": { "description": "generic error response", "schema": { @@ -228,7 +246,13 @@ func init() { "type": "string" }, "state": { - "type": "string" + "type": "string", + "enum": [ + "wip", + "active", + "redirect", + "deleted" + ] } } }, diff --git a/golang/gen/restapi/operations/get_creator_id_responses.go b/golang/gen/restapi/operations/get_creator_id_responses.go index 4c1cee1b..58dcb687 100644 --- a/golang/gen/restapi/operations/get_creator_id_responses.go +++ b/golang/gen/restapi/operations/get_creator_id_responses.go @@ -57,6 +57,50 @@ func (o *GetCreatorIDOK) WriteResponse(rw http.ResponseWriter, producer runtime. } } +// GetCreatorIDNotFoundCode is the HTTP code returned for type GetCreatorIDNotFound +const GetCreatorIDNotFoundCode int = 404 + +/*GetCreatorIDNotFound no such creator + +swagger:response getCreatorIdNotFound +*/ +type GetCreatorIDNotFound struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewGetCreatorIDNotFound creates GetCreatorIDNotFound with default headers values +func NewGetCreatorIDNotFound() *GetCreatorIDNotFound { + + return &GetCreatorIDNotFound{} +} + +// WithPayload adds the payload to the get creator Id not found response +func (o *GetCreatorIDNotFound) WithPayload(payload *models.Error) *GetCreatorIDNotFound { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the get creator Id not found response +func (o *GetCreatorIDNotFound) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *GetCreatorIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(404) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + /*GetCreatorIDDefault generic error response swagger:response getCreatorIdDefault -- cgit v1.2.3