Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Go] Revise Go partial header, minor formatting fix #6695

Merged
merged 1 commit into from
Oct 17, 2017
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
30 changes: 15 additions & 15 deletions modules/swagger-codegen/src/main/resources/go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ func (a *{{{classname}}}Service) {{{nickname}}}({{#hasAuthMethods}}ctx context.C
{{#required}}
{{#minItems}}
if len({{paramName}}) < {{minItems}} {
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements")
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements")
}
{{/minItems}}
{{#maxItems}}
if len({{paramName}}) > {{maxItems}} {
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements")
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements")
}
{{/maxItems}}
{{#minLength}}
if strlen({{paramName}}) < {{minLength}} {
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements")
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements")
}
{{/minLength}}
{{#maxLength}}
if strlen({{paramName}}) > {{maxLength}} {
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements")
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements")
}
{{/maxLength}}
{{#minimum}}
Expand All @@ -83,7 +83,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}({{#hasAuthMethods}}ctx context.C
{{^isString}}
if {{paramName}} < {{minimum}} {
{{/isString}}
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}")
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}")
}
{{/minimum}}
{{#maximum}}
Expand All @@ -94,7 +94,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}({{#hasAuthMethods}}ctx context.C
{{^isString}}
if {{paramName}} > {{maximum}} {
{{/isString}}
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}")
return {{#returnType}}successPayload, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}")
}
{{/maximum}}
{{/required}}
Expand Down Expand Up @@ -206,18 +206,18 @@ func (a *{{{classname}}}Service) {{{nickname}}}({{#hasAuthMethods}}ctx context.C
return {{#returnType}}successPayload, {{/returnType}}nil, err
}

localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, reportError(localVarHttpResponse.Status)
}
}
{{#returnType}}

if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, err
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, err
}

{{/returnType}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
* {{{appDescription}}}
*
{{/appDescription}}
* {{#version}}OpenAPI spec version: {{{version}}}{{/version}}
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
* Generated by: https://github.com/swagger-api/swagger-codegen.git
{{#version}}
* API version: {{{version}}}
{{/version}}
{{#infoEmail}}
* Contact: {{{infoEmail}}}
{{/infoEmail}}
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/animal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/animal_farm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
22 changes: 11 additions & 11 deletions samples/client/petstore/go/go-petstore/another_fake_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down Expand Up @@ -74,17 +74,17 @@ func (a *AnotherFakeApiService) TestSpecialTags(body Client) (Client, *http.Res
return successPayload, nil, err
}

localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status)
}
}

if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
return successPayload, localVarHttpResponse, err
}


Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/api_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/capitalization.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/category.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/class_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/dog.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/enum_arrays.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/enum_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/go/go-petstore/enum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* API version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package petstore
Expand Down
Loading