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

[Golang][client] fix undefined: localVarFile #382

Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6194093
fix undefined: localVarFile
grokify Jun 22, 2018
bf4aedb
add required formData file endpoints to 2.0 and 3.0 specs
grokify Jun 22, 2018
53caca1
streamline api.mustache update
grokify Jun 23, 2018
dc9c683
Merge branch 'master' into go-client/fix/formdata_required-file_undef…
grokify Jun 23, 2018
c7611aa
update sampels
grokify Jun 26, 2018
a543d57
update samples
grokify Jun 26, 2018
e6b0338
Merge branch 'master' into go-client/fix/formdata_required-file_undef…
grokify Jun 26, 2018
118404a
update samples
grokify Jun 26, 2018
5708f85
Merge branch 'master' into go-client/fix/formdata_required-file_undef…
grokify Jun 26, 2018
f72472d
update samples bin/jaxrs-cxf-client-petstore.sh
grokify Jun 26, 2018
10b9419
Merge branch 'master' into go-client/fix/testing
grokify Jun 26, 2018
87e240b
update samples
grokify Jun 26, 2018
3b15c3d
update samples
grokify Jun 27, 2018
2c6791c
update samples run-all-petstore
grokify Jun 27, 2018
61f76d9
Merge branch 'master' into go-client/fix/testing
grokify Jun 27, 2018
83874b1
update samples
grokify Jun 27, 2018
cf42bc8
update samples
grokify Jun 27, 2018
13fd826
update samples
grokify Jun 28, 2018
eb1e146
Trigger CI due to race condition
grokify Jun 28, 2018
89bfda5
merge master 9b909df543b8c541a17aa5a545473e6e511b140d
grokify Jun 28, 2018
2684c0c
update samples
grokify Jun 28, 2018
3439754
update samples
grokify Jun 28, 2018
f5cc397
Trigger CI due to previous timeout
grokify Jun 28, 2018
027091e
Trigger CI due to previous Shippable timeout
grokify Jun 28, 2018
e72745d
Trigger CI due to previous Shippable race condition
grokify Jun 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions modules/openapi-generator/src/main/resources/go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
{{#hasFormParams}}
{{#formParams}}
{{#isFile}}
{{#required}}
localVarFile := {{paramName}}
{{/required}}
{{^required}}
var localVarFile {{dataType}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,43 @@ paths:
- petstore_auth:
- 'write:pets'
- 'read:pets'
'/pet/{petId}/uploadImageWithRequiredFile':
post:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFileWithRequiredFile
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
- name: additionalMetadata
in: formData
description: Additional data to pass to server
required: false
type: string
- name: file
in: formData
description: file to upload
required: true
type: file
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/ApiResponse'
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
/store/inventory:
get:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ paths:
description: Status values that need to be considered for filter
required: true
style: form
explode: false
schema:
type: array
items:
Expand Down Expand Up @@ -112,7 +111,6 @@ paths:
description: Tags to filter by
required: true
style: form
explode: false
schema:
type: array
items:
Expand Down Expand Up @@ -267,6 +265,47 @@ paths:
description: file to upload
type: string
format: binary
'/pet/{petId}/uploadImageWithRequiredFile':
post:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFileWithRequiredFile
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
type: string
format: binary
required:
- file
/store/inventory:
get:
tags:
Expand Down Expand Up @@ -436,7 +475,7 @@ paths:
type: integer
format: int32
X-Expires-After:
description: date in UTC when toekn expires
description: date in UTC when token expires
schema:
type: string
format: date-time
Expand Down Expand Up @@ -573,7 +612,6 @@ paths:
parameters:
- name: enum_header_string_array
in: header
explode: true
description: Header parameter enum test (string array)
schema:
type: array
Expand Down Expand Up @@ -876,6 +914,26 @@ paths:
type: string
description: request body
required: true
/fake/body-with-query-params:
put:
tags:
- fake
operationId: testBodyWithQueryParams
parameters:
- name: query
in: query
required: true
schema:
type: string
responses:
'200':
description: Success
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
/another-fake/dummy:
patch:
tags:
Expand All @@ -892,9 +950,6 @@ paths:
$ref: '#/components/schemas/Client'
requestBody:
$ref: '#/components/requestBodies/Client'
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
requestBodies:
UserArray:
Expand Down Expand Up @@ -1394,6 +1449,7 @@ components:
type: string
OuterBoolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
_special_model.name_:
properties:
'$special[property.name]':
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.0.3-SNAPSHOT
36 changes: 18 additions & 18 deletions samples/client/petstore-security-test/go/api/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
openapi: 3.0.1
info:
title: OpenAPI Petstore */ ' " =end -- \r\n \n \r
contact:
email: [email protected] */ ' " =end -- \r\n \n \r
description: "This spec is mainly for testing Petstore server and contains fake\
\ endpoints, models. Please do not use this for any other purpose. Special characters:\
\ \" \\ */ ' \" =end -- \r\n \n \r"
termsOfService: http://url.to/terms/ */ ' " =end -- \r\n \n \r
contact:
email: [email protected] */ ' " =end -- \r\n \n \r
license:
name: Apache-2.0 */ ' " =end -- \r\n \n \r
url: http://www.apache.org/licenses/LICENSE-2.0.html */ ' " =end -- \r\n \n \r
termsOfService: http://url.to/terms/ */ ' " =end -- \r\n \n \r
title: OpenAPI Petstore */ ' " =end -- \r\n \n \r
version: 1.0.0 */ ' " =end -- \r\n \n \r
externalDocs:
description: Find out more about OpenAPI */ ' " =end -- \r\n \n \r
url: https://openapis.org
servers:
- url: petstore.swagger.io */ ' " =end -- \r\n \n \r/v2 */ ' " =end -- \r\n \n \r
tags:
- name: fake
description: Everything about your Pets */ ' " =end -- \r\n \n \r
- description: Everything about your Pets */ ' " =end -- \r\n \n \r
externalDocs:
description: Find out more */ ' " =end -- \r\n \n \r
url: https://openapis.org
name: fake
paths:
/fake:
put:
tags:
- fake
summary: To test code injection */ ' " =end -- \r\n \n \r
operationId: testCodeInject */ ' " =end -- \r\n \n \r
requestBody:
content:
application/json:
schema:
properties:
test code inject */ ' " =end -- \r\n \n \r:
type: string
description: To test code injection */ ' " =end -- \r\n \n \r
type: string
? "*/ ' \" =end -- \r\n \n \r"
: schema:
properties:
test code inject */ ' " =end -- \r\n \n \r:
type: string
description: To test code injection */ ' " =end -- \r\n \n \r
type: string
responses:
400:
description: To test code injection */ ' " =end -- \r\n \n \r
content: {}
description: To test code injection */ ' " =end -- \r\n \n \r
summary: To test code injection */ ' " =end -- \r\n \n \r
tags:
- fake
components:
schemas:
Return:
type: object
description: Model for testing reserved words */ ' " =end -- \r\n \n \r
properties:
return:
type: integer
description: property description */ ' " =end -- \r\n \n \r
format: int32
description: Model for testing reserved words */ ' " =end -- \r\n \n \r
type: integer
type: object
xml:
name: Return
securitySchemes:
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
scopes:
write:pets: modify pets in your account */ ' " =end -- \r\n \n \r
read:pets: read your pets */ ' " =end -- \r\n \n \r
type: oauth2
api_key:
type: apiKey
name: api_key */ ' " =end -- \r\n \n \r
in: header
name: api_key */ ' " =end -- \r\n \n \r
type: apiKey
6 changes: 3 additions & 3 deletions samples/client/petstore-security-test/go/api_fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type FakeApiService service
FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *TestCodeInjectEndRnNROpts - Optional Parameters:
* @param "UNKNOWNBASETYPE" (optional.Interface of interface{}) -
* @param "UNKNOWNBASETYPE" (optional.Interface of map[string]interface{}) -
*/

type TestCodeInjectEndRnNROpts struct {
Expand Down Expand Up @@ -70,9 +70,9 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti
}
// body params
if localVarOptionals != nil && localVarOptionals.UNKNOWNBASETYPE.IsSet() {
localVarOptionalUNKNOWNBASETYPE, localVarOptionalUNKNOWNBASETYPEok := localVarOptionals.UNKNOWNBASETYPE.Value().(interface{})
localVarOptionalUNKNOWNBASETYPE, localVarOptionalUNKNOWNBASETYPEok := localVarOptionals.UNKNOWNBASETYPE.Value().(map[string]interface{})
if !localVarOptionalUNKNOWNBASETYPEok {
return nil, reportError("uNKNOWNBASETYPE should be interface{}")
return nil, reportError("uNKNOWNBASETYPE should be map[string]interface{}")
}
localVarPostBody = &localVarOptionalUNKNOWNBASETYPE
}
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore-security-test/go/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c contextKey) String() string {
}

var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")

// ContextBasicAuth takes BasicAuth as authentication for the request.
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore-security-test/go/docs/FakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Optional parameters are passed through a pointer to a TestCodeInjectEndRnNROpts

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**uNKNOWNBASETYPE** | [**optional.Interface of interface{}**](UNKNOWN_BASE_TYPE.md)| |
**uNKNOWNBASETYPE** | [**optional.Interface of map[string]interface{}**](UNKNOWN_BASE_TYPE.md)| |

### Return type

Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/R/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.0.3-SNAPSHOT
2 changes: 1 addition & 1 deletion samples/client/petstore/ada/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.3-SNAPSHOT
Loading