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

Oleastre fix check for file type #570

Merged
merged 3 commits into from
Dec 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#is this 'form-param'}}{{#isNot this 'binary'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}FormDataContentDisposition fileDetail{{/is}}{{/is}}
{{#is this 'form-param'}}{{#isNot this 'binary'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}FormDataContentDisposition fileDetail{{/is}}{{/is}}
Original file line number Diff line number Diff line change
@@ -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}}
{{#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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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}}
{{#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}}
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/csharp-dotnet2/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/handlebars/csharp/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/csharp/api_doc.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/python/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/python/api_doc.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down