diff --git a/modules/swagger-codegen/src/main/resources/go/api_response.mustache b/modules/swagger-codegen/src/main/resources/go/api_response.mustache new file mode 100644 index 0000000000..b9110bd9ed --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/api_response.mustache @@ -0,0 +1,24 @@ +package swagger + +import ( + "net/http" +) + + +type ApiResponse struct { + *http.Response + + Message string `json:"message,omitempty"` +} + +func NewApiResponse(r *http.Response) *ApiResponse { + response := &ApiResponse{Response: r} + + return response +} + +func NewApiResponseWithError(errorMessage string) *ApiResponse { + response := &ApiResponse{Message: errorMessage} + + return response +} \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore/model_api_response.go b/samples/client/petstore/go/go-petstore/model_api_response.go new file mode 100644 index 0000000000..0905f55cf0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/model_api_response.go @@ -0,0 +1,14 @@ +package swagger + +import ( +) + + +type ModelApiResponse struct { + + Code int32 `json:"code,omitempty"` + + Type_ string `json:"type,omitempty"` + + Message string `json:"message,omitempty"` +}