Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into master
  • Loading branch information
Ravisankar-Challa committed Mar 28, 2021
2 parents 4a50fab + e5ef6cb commit 0a1b3c2
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 6 deletions.
Expand Up @@ -51,6 +51,7 @@ public AbstractGoCodegen() {
"complex64",
"complex128",
"rune",
"interface{}",
"byte")
);

Expand Down
Expand Up @@ -25,6 +25,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String PACKAGE_URL = "packageUrl";
public static final String DEFAULT_LIBRARY = "urllib3";

public static final String WRITE_BINARY_OPTION = "writeBinary";

protected String packageName; // e.g. petstore_api
protected String packageVersion;
protected String projectName; // for setup.py, e.g. petstore-api
Expand Down Expand Up @@ -174,6 +176,11 @@ public void processOpts() {
setPackageVersion("1.0.0");
}

if (additionalProperties.containsKey(WRITE_BINARY_OPTION)) {
boolean optionValue = Boolean.parseBoolean(String.valueOf(additionalProperties.get(WRITE_BINARY_OPTION)));
additionalProperties.put(WRITE_BINARY_OPTION, optionValue);
}

additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName);
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
Expand Down
Expand Up @@ -540,7 +540,7 @@ class ApiClient(object):
content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
with open(path, {{^writeBinary}}"w"{{/writeBinary}}{{#writeBinary}}"wb"{{/writeBinary}}) as f:
f.write(response.data)

return path
Expand Down
@@ -1 +1 @@
2.4.16-SNAPSHOT
2.4.20-SNAPSHOT
@@ -1 +1 @@
2.4.19-SNAPSHOT
2.4.20-SNAPSHOT
2 changes: 1 addition & 1 deletion samples/client/petstore/go/go-petstore/docs/FakeApi.md
Expand Up @@ -316,7 +316,7 @@ test inline additionalProperties
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**param** | [**interface{}**](interface{}.md)| request body |
**param** | **interface{}**| request body |

### Return type

Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/python/.swagger-codegen/VERSION
@@ -1 +1 @@
2.4.19-SNAPSHOT
2.4.20-SNAPSHOT
2 changes: 1 addition & 1 deletion samples/client/petstore/python/petstore_api/api_client.py
Expand Up @@ -534,7 +534,7 @@ def __deserialize_file(self, response):
content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
with open(path, "w") as f:
f.write(response.data)

return path
Expand Down

0 comments on commit 0a1b3c2

Please sign in to comment.