forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GO CLIENT] Fix issue with generating code for API key (swagger-api#6630
) * [GO CLIENT] Fix Go security query parameter generation by using correct string literal and using the Add method. * Add generated files.
- Loading branch information
Showing
10 changed files
with
206 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
samples/client/petstore-security-test/go/.swagger-codegen/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.3.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
samples/client/petstore/go/go-petstore/another_fake_api.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Swagger Petstore | ||
* | ||
* 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 | ||
* Contact: [email protected] | ||
* Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
*/ | ||
|
||
package petstore | ||
|
||
import ( | ||
"net/url" | ||
"net/http" | ||
"strings" | ||
"golang.org/x/net/context" | ||
"encoding/json" | ||
) | ||
|
||
// Linger please | ||
var ( | ||
_ context.Context | ||
) | ||
|
||
type AnotherFakeApiService service | ||
|
||
|
||
/* AnotherFakeApiService To test special tags | ||
To test special tags | ||
@param body client model | ||
@return Client*/ | ||
func (a *AnotherFakeApiService) TestSpecialTags(body Client) (Client, *http.Response, error) { | ||
var ( | ||
localVarHttpMethod = strings.ToUpper("Patch") | ||
localVarPostBody interface{} | ||
localVarFileName string | ||
localVarFileBytes []byte | ||
successPayload Client | ||
) | ||
|
||
// create path and map variables | ||
localVarPath := a.client.cfg.BasePath + "/another-fake/dummy" | ||
|
||
localVarHeaderParams := make(map[string]string) | ||
localVarQueryParams := url.Values{} | ||
localVarFormParams := url.Values{} | ||
|
||
|
||
// to determine the Content-Type header | ||
localVarHttpContentTypes := []string{ "application/json", } | ||
|
||
// set Content-Type header | ||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) | ||
if localVarHttpContentType != "" { | ||
localVarHeaderParams["Content-Type"] = localVarHttpContentType | ||
} | ||
|
||
// to determine the Accept header | ||
localVarHttpHeaderAccepts := []string{ | ||
"application/json", | ||
} | ||
|
||
// set Accept header | ||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) | ||
if localVarHttpHeaderAccept != "" { | ||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept | ||
} | ||
// body params | ||
localVarPostBody = &body | ||
r, err := a.client.prepareRequest(nil, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) | ||
if err != nil { | ||
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 { | ||
return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status) | ||
} | ||
|
||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { | ||
return successPayload, localVarHttpResponse, err | ||
} | ||
|
||
|
||
return successPayload, localVarHttpResponse, err | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
samples/client/petstore/go/go-petstore/docs/AnotherFakeApi.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# \AnotherFakeApi | ||
|
||
All URIs are relative to *http://petstore.swagger.io:80/v2* | ||
|
||
Method | HTTP request | Description | ||
------------- | ------------- | ------------- | ||
[**TestSpecialTags**](AnotherFakeApi.md#TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags | ||
|
||
|
||
# **TestSpecialTags** | ||
> Client TestSpecialTags(body) | ||
To test special tags | ||
|
||
To test special tags | ||
|
||
### Required Parameters | ||
|
||
Name | Type | Description | Notes | ||
------------- | ------------- | ------------- | ------------- | ||
**body** | [**Client**](Client.md)| client model | | ||
|
||
### Return type | ||
|
||
[**Client**](Client.md) | ||
|
||
### Authorization | ||
|
||
No authorization required | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: application/json | ||
- **Accept**: application/json | ||
|
||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) | ||
|
35 changes: 35 additions & 0 deletions
35
samples/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# \FakeClassnameTags123Api | ||
|
||
All URIs are relative to *http://petstore.swagger.io:80/v2* | ||
|
||
Method | HTTP request | Description | ||
------------- | ------------- | ------------- | ||
[**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case | ||
|
||
|
||
# **TestClassname** | ||
> Client TestClassname(ctx, body) | ||
To test class name in snake case | ||
|
||
### Required Parameters | ||
|
||
Name | Type | Description | Notes | ||
------------- | ------------- | ------------- | ------------- | ||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication | ||
**body** | [**Client**](Client.md)| client model | | ||
|
||
### Return type | ||
|
||
[**Client**](Client.md) | ||
|
||
### Authorization | ||
|
||
[api_key_query](../README.md#api_key_query) | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: application/json | ||
- **Accept**: application/json | ||
|
||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters