Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified bin/go-petstore-withxml.sh
100644 → 100755
Empty file.
5 changes: 0 additions & 5 deletions modules/swagger-codegen/src/main/resources/go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
}
{{#responses}}{{#dataType}}
if localVarHttpResponse.StatusCode == {{{code}}} {
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err
}

var v {{{dataType}}}
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/go/go-petstore-withXml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **Patch** /another-fake/dummy | To test special tags
*DefaultApi* | [**TestBodyWithQueryParams**](docs/DefaultApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params |
*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **Post** /fake/outer/boolean |
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite |
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number |
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string |
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params |
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters
Expand Down
21 changes: 21 additions & 0 deletions samples/client/petstore/go/go-petstore-withXml/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,14 @@ paths:
required: false
type: "string"
x-exportParamName: "Name"
x-optionalDataType: "String"
- name: "status"
in: "formData"
description: "Updated status of the pet"
required: false
type: "string"
x-exportParamName: "Status"
x-optionalDataType: "String"
responses:
405:
description: "Invalid input"
Expand All @@ -244,6 +246,7 @@ paths:
required: false
type: "string"
x-exportParamName: "ApiKey"
x-optionalDataType: "String"
- name: "petId"
in: "path"
description: "Pet id to delete"
Expand Down Expand Up @@ -283,6 +286,7 @@ paths:
required: false
type: "string"
x-exportParamName: "AdditionalMetadata"
x-optionalDataType: "String"
- name: "file"
in: "formData"
description: "file to upload"
Expand Down Expand Up @@ -651,6 +655,7 @@ paths:
- "-efg"
- "(xyz)"
x-exportParamName: "EnumFormString"
x-optionalDataType: "String"
- name: "enum_header_string_array"
in: "header"
description: "Header parameter enum test (string array)"
Expand All @@ -674,6 +679,7 @@ paths:
- "-efg"
- "(xyz)"
x-exportParamName: "EnumHeaderString"
x-optionalDataType: "String"
- name: "enum_query_string_array"
in: "query"
description: "Query parameter enum test (string array)"
Expand All @@ -697,6 +703,7 @@ paths:
- "-efg"
- "(xyz)"
x-exportParamName: "EnumQueryString"
x-optionalDataType: "String"
- name: "enum_query_integer"
in: "query"
description: "Query parameter enum test (double)"
Expand All @@ -707,6 +714,7 @@ paths:
- 1
- -2
x-exportParamName: "EnumQueryInteger"
x-optionalDataType: "Int32"
- name: "enum_query_double"
in: "formData"
description: "Query parameter enum test (double)"
Expand All @@ -717,6 +725,7 @@ paths:
- 1.1
- -1.2
x-exportParamName: "EnumQueryDouble"
x-optionalDataType: "Float64"
responses:
400:
description: "Invalid request"
Expand Down Expand Up @@ -745,6 +754,7 @@ paths:
maximum: 100
minimum: 10
x-exportParamName: "Integer"
x-optionalDataType: "Int32"
- name: "int32"
in: "formData"
description: "None"
Expand All @@ -754,13 +764,15 @@ paths:
minimum: 20
format: "int32"
x-exportParamName: "Int32_"
x-optionalDataType: "Int32"
- name: "int64"
in: "formData"
description: "None"
required: false
type: "integer"
format: "int64"
x-exportParamName: "Int64_"
x-optionalDataType: "Int64"
- name: "number"
in: "formData"
description: "None"
Expand All @@ -777,6 +789,7 @@ paths:
maximum: 987.6
format: "float"
x-exportParamName: "Float"
x-optionalDataType: "Float32"
- name: "double"
in: "formData"
description: "None"
Expand All @@ -793,6 +806,7 @@ paths:
type: "string"
pattern: "/[a-z]/i"
x-exportParamName: "String_"
x-optionalDataType: "String"
- name: "pattern_without_delimiter"
in: "formData"
description: "None"
Expand All @@ -814,20 +828,23 @@ paths:
type: "string"
format: "binary"
x-exportParamName: "Binary"
x-optionalDataType: "String"
- name: "date"
in: "formData"
description: "None"
required: false
type: "string"
format: "date"
x-exportParamName: "Date"
x-optionalDataType: "String"
- name: "dateTime"
in: "formData"
description: "None"
required: false
type: "string"
format: "date-time"
x-exportParamName: "DateTime"
x-optionalDataType: "Time"
- name: "password"
in: "formData"
description: "None"
Expand All @@ -837,12 +854,14 @@ paths:
minLength: 10
format: "password"
x-exportParamName: "Password"
x-optionalDataType: "String"
- name: "callback"
in: "formData"
description: "None"
required: false
type: "string"
x-exportParamName: "Callback"
x-optionalDataType: "String"
responses:
400:
description: "Invalid username supplied"
Expand Down Expand Up @@ -998,6 +1017,8 @@ paths:
description: "successful operation"
/fake/body-with-query-params:
put:
tags:
- "fake"
operationId: "testBodyWithQueryParams"
consumes:
- "application/json"
Expand Down
19 changes: 9 additions & 10 deletions samples/client/petstore/go/go-petstore-withXml/api_another_fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"net/http"
"net/url"
"strings"
"golang.org/x/net/context"
"context"
)

// Linger please
Expand All @@ -25,11 +25,14 @@ var (

type AnotherFakeApiService service

/* AnotherFakeApiService To test special tags
/*
AnotherFakeApiService To test special tags
To test special tags
* @param ctx context.Context for authentication, logging, tracing, etc.
@param body client model
@return Client*/
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body client model

@return Client
*/
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
Expand Down Expand Up @@ -76,6 +79,7 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
}

localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
Expand All @@ -95,11 +99,6 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
}

if localVarHttpResponse.StatusCode == 200 {
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}

var v Client
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
if err != nil {
Expand Down
Loading