diff --git a/src/main/resources/handlebars/JavaInflector/formParams.mustache b/src/main/resources/handlebars/JavaInflector/formParams.mustache index 414a56435d..2b68f2fc24 100644 --- a/src/main/resources/handlebars/JavaInflector/formParams.mustache +++ b/src/main/resources/handlebars/JavaInflector/formParams.mustache @@ -1 +1 @@ - {{#is this 'form-param'}}{{#isNot this 'binary'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}FormDataContentDisposition fileDetail{{/is}}{{/is}} \ No newline at end of file + {{#is this 'form-param'}}{{#isNot this 'binary'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}FormDataContentDisposition fileDetail{{/is}}{{/is}} diff --git a/src/main/resources/handlebars/JavaSpring/formParams.mustache b/src/main/resources/handlebars/JavaSpring/formParams.mustache index d4095e43f2..b91da48cfe 100644 --- a/src/main/resources/handlebars/JavaSpring/formParams.mustache +++ b/src/main/resources/handlebars/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isBinary}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^@last}}, {{/@last}}{{#@last}}{{/@last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isBinary}}{{#isBinary}}@ApiParam(value = "file detail") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") MultipartFile {{baseName}}{{/isBinary}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isBinary}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^@last}}, {{/@last}}{{#@last}}{{/@last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isBinary}}{{#isBinary}}@ApiParam(value = "file detail") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") MultipartFile {{baseName}}{{/isBinary}}{{/isFormParam}} diff --git a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/api_test.mustache b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/api_test.mustache index 6558eb235c..7dcdf57563 100644 --- a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/api_test.mustache +++ b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/api_test.mustache @@ -28,12 +28,12 @@ public class {{classname}}ControllerIntegrationTest { @Test public void {{operationId}}Test() throws Exception { {{#parameters}} - {{^isFile}} + {{^isBinary}} {{{dataType}}} {{paramName}} = {{{example}}}; - {{/isFile}} - {{#isFile}} + {{/isBinary}} + {{#isBinary}} org.springframework.web.multipart.MultipartFile {{paramName}} = null; - {{/isFile}} + {{/isBinary}} {{/parameters}} ResponseEntity<{{>returnTypes}}> responseEntity = api.{{operationId}}({{#parameters}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}); assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode()); diff --git a/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/api_test.mustache b/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/api_test.mustache index 0723a652b4..b9cf5a2773 100644 --- a/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/api_test.mustache +++ b/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/api_test.mustache @@ -29,12 +29,12 @@ private {{classname}} api; @Test public void {{operationId}}Test() throws Exception { {{#parameters}} - {{^isFile}} + {{^isBinary}} {{{dataType}}} {{paramName}} = {{{example}}}; - {{/isFile}} - {{#isFile}} + {{/isBinary}} + {{#isBinary}} org.springframework.web.multipart.MultipartFile {{paramName}} = null; - {{/isFile}} + {{/isBinary}} {{/parameters}} api.{{operationId}}({{#parameters}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}); // todo: add verifications diff --git a/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/formParams.mustache b/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/formParams.mustache index 914621e532..4fc0ac6d4f 100644 --- a/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/formParams.mustache +++ b/src/main/resources/handlebars/JavaSpring/libraries/spring-cloud/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isBinary}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isBinary}}{{#isBinary}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/isBinary}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isBinary}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isBinary}}{{#isBinary}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/isBinary}}{{/isFormParam}} diff --git a/src/main/resources/handlebars/csharp-dotnet2/api.mustache b/src/main/resources/handlebars/csharp-dotnet2/api.mustache index ff0445d6d9..ea612d5c67 100644 --- a/src/main/resources/handlebars/csharp-dotnet2/api.mustache +++ b/src/main/resources/handlebars/csharp-dotnet2/api.mustache @@ -107,7 +107,7 @@ namespace {{apiPackage}} {{/queryParams}} {{#headerParams}} if ({{paramName}} != null) headerParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // header parameter {{/headerParams}} - {{#formParams}}if ({{paramName}} != null) {{#isFile}}fileParams.Add("{{baseName}}", ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}formParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}} + {{#formParams}}if ({{paramName}} != null) {{#isBinary}}fileParams.Add("{{baseName}}", ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isBinary}}{{^isBinary}}formParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // form parameter{{/isBinary}} {{/formParams}} {{#bodyParam}}postBody = ApiClient.Serialize({{paramName}}); // http body (model) parameter {{/bodyParam}} diff --git a/src/main/resources/handlebars/csharp-dotnet2/api_doc.mustache b/src/main/resources/handlebars/csharp-dotnet2/api_doc.mustache index 3e51f10b5c..c8625885ba 100644 --- a/src/main/resources/handlebars/csharp-dotnet2/api_doc.mustache +++ b/src/main/resources/handlebars/csharp-dotnet2/api_doc.mustache @@ -77,7 +77,7 @@ namespace Example {{^parameters}}This endpoint does not need any parameter.{{/parameters}}{{#parameters}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/parameters}} -{{#parameters}} **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#parameters}} **{{paramName}}** | {{#isBinary}}**{{{dataType}}}**{{/isBinary}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isBinary}}[**{{{dataType}}}**]({{baseType}}.md){{/isBinary}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} {{/parameters}} ### Return type diff --git a/src/main/resources/handlebars/csharp/api.mustache b/src/main/resources/handlebars/csharp/api.mustache index e720fcd5d6..123180a529 100644 --- a/src/main/resources/handlebars/csharp/api.mustache +++ b/src/main/resources/handlebars/csharp/api.mustache @@ -254,7 +254,7 @@ namespace {{packageName}}.{{apiPackage}} {{/headerParams}} {{#isForm}} {{#formParams}} - if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}} + if ({{paramName}} != null) {{#isBinary}}localVarFileParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isBinary}}{{^isBinary}}localVarFormParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isBinary}} {{/formParams}} {{/isForm}} {{^isForm}} @@ -400,7 +400,7 @@ namespace {{packageName}}.{{apiPackage}} {{/headerParams}} {{#isForm}} {{#formParams}} - if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}} + if ({{paramName}} != null) {{#isBinary}}localVarFileParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isBinary}}{{^isBinary}}localVarFormParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isBinary}} {{/formParams}} {{/isForm}} {{^isForm}} diff --git a/src/main/resources/handlebars/csharp/api_doc.mustache b/src/main/resources/handlebars/csharp/api_doc.mustache index 4fe2a2c4b9..4ed1ca0fdb 100644 --- a/src/main/resources/handlebars/csharp/api_doc.mustache +++ b/src/main/resources/handlebars/csharp/api_doc.mustache @@ -85,7 +85,7 @@ namespace Example {{^parameters}}This endpoint does not need any parameter.{{/parameters}}{{#parameters}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/parameters}} -{{#parameters}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{#isContainer}}{{baseType}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#parameters}} **{{paramName}}** | {{#isBinary}}**{{dataType}}**{{/isBinary}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isBinary}}[**{{dataType}}**]({{#isContainer}}{{baseType}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}.md){{/isBinary}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} {{/parameters}} ### Return type diff --git a/src/main/resources/handlebars/python/api.mustache b/src/main/resources/handlebars/python/api.mustache index e0ec79a8f2..72c617ad34 100644 --- a/src/main/resources/handlebars/python/api.mustache +++ b/src/main/resources/handlebars/python/api.mustache @@ -172,7 +172,7 @@ class {{classname}}(object): local_var_files = {} {{#formParams}} if '{{paramName}}' in params: - {{#notFile}}form_params.append(('{{baseName}}', params['{{paramName}}'])){{/notFile}}{{#isFile}}local_var_files['{{baseName}}'] = params['{{paramName}}']{{/isFile}}{{#isListContainer}} # noqa: E501 + {{#notBinary}}form_params.append(('{{baseName}}', params['{{paramName}}'])){{/notBinary}}{{#isBinary}}local_var_files['{{baseName}}'] = params['{{paramName}}']{{/isBinary}}{{#isListContainer}} # noqa: E501 collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 {{/formParams}} diff --git a/src/main/resources/handlebars/python/api_doc.mustache b/src/main/resources/handlebars/python/api_doc.mustache index 1382f59f12..240a0c3bf4 100644 --- a/src/main/resources/handlebars/python/api_doc.mustache +++ b/src/main/resources/handlebars/python/api_doc.mustache @@ -65,7 +65,7 @@ except ApiException as e: {{^parameters}}This endpoint does not need any parameter.{{/parameters}}{{#parameters}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/parameters}} -{{#parameters}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}{{/isFile}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#parameters}} **{{paramName}}** | {{#isBinary}}**{{dataType}}**{{/isBinary}}{{^isBinary}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}{{/isBinary}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} {{/parameters}} ### Return type