{"action":"created","issue":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/382","repository_url":"https://api.github.com/repos/OpenAPITools/openapi-generator","labels_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/382/labels{/name}","comments_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/382/comments","events_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/382/events","html_url":"https://github.com/OpenAPITools/openapi-generator/pull/382","id":334922562,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NzcyMDYy","number":382,"title":"[Golang][client] fix undefined: localVarFile","user":{"login":"grokify","id":209872,"node_id":"MDQ6VXNlcjIwOTg3Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/209872?v=4","gravatar_id":"","url":"https://api.github.com/users/grokify","html_url":"https://github.com/grokify","followers_url":"https://api.github.com/users/grokify/followers","following_url":"https://api.github.com/users/grokify/following{/other_user}","gists_url":"https://api.github.com/users/grokify/gists{/gist_id}","starred_url":"https://api.github.com/users/grokify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grokify/subscriptions","organizations_url":"https://api.github.com/users/grokify/orgs","repos_url":"https://api.github.com/users/grokify/repos","events_url":"https://api.github.com/users/grokify/events{/privacy}","received_events_url":"https://api.github.com/users/grokify/received_events","type":"User","site_admin":false},"labels":[{"id":931402847,"node_id":"MDU6TGFiZWw5MzE0MDI4NDc=","url":"https://api.github.com/repos/OpenAPITools/openapi-generator/labels/Client:%20Go","name":"Client: Go","color":"fad8c7","default":false},{"id":931403399,"node_id":"MDU6TGFiZWw5MzE0MDMzOTk=","url":"https://api.github.com/repos/OpenAPITools/openapi-generator/labels/Issue:%20Bug","name":"Issue: Bug","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-06-22T15:30:48Z","updated_at":"2018-06-30T20:51:55Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/pulls/382","html_url":"https://github.com/OpenAPITools/openapi-generator/pull/382","diff_url":"https://github.com/OpenAPITools/openapi-generator/pull/382.diff","patch_url":"https://github.com/OpenAPITools/openapi-generator/pull/382.patch"},"body":"### PR checklist\r\n\r\n- [x] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).\r\n- [x] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\\bin\\windows\\`.\r\n- [x] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `3.1.x`, `4.0.x`. Default: `master`.\r\n- [x] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.\r\n\r\n@antihax\r\n@bvwells\r\n\r\n### Description of the PR\r\n\r\nWhen building a Go client with a required `formData` parameter of `file` type, a `undefined: localVarFile` error is countered when compiling the client.\r\n\r\nThis happens because `localVarFile` is currently only defined when a file is optional. This fix does the following:\r\n\r\n* defines `localVarFile` when a file is required\r\n* sets `localVarFile` to the variable name as defined in the function call\r\n\r\n#### Known Limitations\r\n\r\nThis approach can only handle a single file, but this is also a limitation of the current Go generator can as `APIClient.prepareRequest()` takes a single pair of `localVarFileName` and `localVarFileBytes` parameters. A future enhancement could support multiple files, either with the same `multipart/form-data` `name` or different ones.\r\n\r\n#### Tests\r\n\r\n`mvn package` was successfully run in the `samples/client/petstore/go` directory.\r\n\r\nAdditional Petstore tests were not added for this use case yet because an endpoint with a required `formData` file is not present in the Petstore spec. Adding this endpoint path to the Petstore spec will be a future project.\r\n\r\nThis has been tested locally with the following Swagger spec with a successful required file upload.\r\n\r\nhttps://github.com/grokify/go-ringcentral/blob/master/codegen/swagger_spec.yaml\r\n\r\n#### References\r\n\r\n* https://github.com/swagger-api/swagger-codegen/issues/7311\r\n* https://github.com/grokify/go-ringcentral/issues/27"},"comment":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/comments/401565634","html_url":"https://github.com/OpenAPITools/openapi-generator/pull/382#issuecomment-401565634","issue_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/382","id":401565634,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTU2NTYzNA==","user":{"login":"grokify","id":209872,"node_id":"MDQ6VXNlcjIwOTg3Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/209872?v=4","gravatar_id":"","url":"https://api.github.com/users/grokify","html_url":"https://github.com/grokify","followers_url":"https://api.github.com/users/grokify/followers","following_url":"https://api.github.com/users/grokify/following{/other_user}","gists_url":"https://api.github.com/users/grokify/gists{/gist_id}","starred_url":"https://api.github.com/users/grokify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grokify/subscriptions","organizations_url":"https://api.github.com/users/grokify/orgs","repos_url":"https://api.github.com/users/grokify/repos","events_url":"https://api.github.com/users/grokify/events{/privacy}","received_events_url":"https://api.github.com/users/grokify/received_events","type":"User","site_admin":false},"created_at":"2018-06-30T20:51:55Z","updated_at":"2018-06-30T20:51:55Z","author_association":"CONTRIBUTOR","body":"> @wing328 I ran into similar issues to this before where we wanted to add a test case but doing so broke other clients as they did not support part of the standard.\r\n> \r\n> What would be the best way to proceed in these cases?\r\n\r\n@antihax In this case, the samples just had to be rebuilt, but there were some nuances. A PR to enhance `bin/jaxrs-cxf-petstore-server.sh` looks like it may be useful.\r\n\r\nIf you have this or other test cases to add, feel free to let me know. I'm interested in adding test cases to verify functionality and I'd be happy to look into getting other tests to pass. Doing this a few times can streamline the process."}}
{"actor":{"display_login":"grokify"}}