From 3864c60b4f726a392c210f7f1b6bb5c25951e6a7 Mon Sep 17 00:00:00 2001 From: Gerard de Leeuw Date: Wed, 26 Sep 2018 14:12:48 +0200 Subject: [PATCH 1/7] Add vendor extension for binary types --- .../io/swagger/codegen/v3/generators/DefaultCodegenConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java index 90a282f994..c03832bdb6 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java +++ b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java @@ -2264,6 +2264,8 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) codegenProperty = codegenProperty.items; } collectionFormat = getCollectionFormat(parameter); + } else if (parameterSchema instanceof BinarySchema) { + codegenParameter.getVendorExtensions().put(CodegenConstants.IS_BINARY_EXT_NAME, Boolean.TRUE); } else if (parameterSchema instanceof FileSchema) { codegenParameter.getVendorExtensions().put(CodegenConstants.IS_FILE_EXT_NAME, Boolean.TRUE); } From cc8982d4646c2411f7036fa28aa36795b6513690 Mon Sep 17 00:00:00 2001 From: Gerard de Leeuw Date: Wed, 26 Sep 2018 14:13:18 +0200 Subject: [PATCH 2/7] Handle binary types properly in the Java resttemplate client --- .../handlebars/Java/libraries/resttemplate/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/handlebars/Java/libraries/resttemplate/api.mustache b/src/main/resources/handlebars/Java/libraries/resttemplate/api.mustache index a4c99b8529..15fd6bad68 100644 --- a/src/main/resources/handlebars/Java/libraries/resttemplate/api.mustache +++ b/src/main/resources/handlebars/Java/libraries/resttemplate/api.mustache @@ -102,7 +102,7 @@ public class {{classname}} { {{#hasFormParams}} {{#formParams}} if ({{paramName}} != null) - {{localVariablePrefix}}formParams.add("{{baseName}}", {{#is this 'file'}}new FileSystemResource({{paramName}}){{/is}}{{#isNot this 'file'}}{{paramName}}{{/isNot}}); + {{localVariablePrefix}}formParams.add("{{baseName}}", {{#is this 'binary'}}new FileSystemResource({{paramName}}){{/is}}{{#isNot this 'binary'}}{{paramName}}{{/isNot}}); {{/formParams}} {{/hasFormParams}} From 0c95c545ebe56d689d3a51537da303698cd31d7c Mon Sep 17 00:00:00 2001 From: Gerard de Leeuw Date: Wed, 26 Sep 2018 14:29:12 +0200 Subject: [PATCH 3/7] Add a comment that the 'type' format does not exist in OAS 3.0 --- .../io/swagger/codegen/v3/generators/DefaultCodegenConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java index c03832bdb6..fcc7bea718 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java +++ b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java @@ -1024,7 +1024,7 @@ private static String getTypeOfSchema(Schema schema) { } else if (schema instanceof BinarySchema) { return SchemaTypeUtil.BINARY_FORMAT; } else if (schema instanceof FileSchema) { - return "file"; + return "file"; // FIXME: this type does not exist in the OpenAPI 3.0 specification } else if (schema instanceof BooleanSchema) { return SchemaTypeUtil.BOOLEAN_TYPE; } else if (schema instanceof DateSchema) { From 467a4119baee5033d57ee046129eb51eaf6e99e9 Mon Sep 17 00:00:00 2001 From: Gerard de Leeuw Date: Wed, 26 Sep 2018 14:36:28 +0200 Subject: [PATCH 4/7] Handlebars templates: Replaced all checks for file type with a check for binary type --- src/main/resources/handlebars/Java/api_doc.mustache | 2 +- .../handlebars/Java/libraries/retrofit/formParams.mustache | 2 +- .../handlebars/Java/libraries/retrofit2/formParams.mustache | 2 +- .../resources/handlebars/JavaInflector/formParams.mustache | 2 +- src/main/resources/handlebars/JavaJaxRS/api.mustache | 2 +- src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache | 2 +- .../handlebars/JavaJaxRS/cxf-cdi/formParams.mustache | 2 +- .../handlebars/JavaJaxRS/cxf-cdi/serviceFormParams.mustache | 2 +- src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache | 2 +- .../resources/handlebars/JavaJaxRS/cxf/formParams.mustache | 2 +- .../handlebars/JavaJaxRS/cxf/formParamsImpl.mustache | 2 +- src/main/resources/handlebars/JavaJaxRS/di/api.mustache | 2 +- src/main/resources/handlebars/JavaJaxRS/formParams.mustache | 2 +- .../handlebars/JavaJaxRS/libraries/jersey1/api.mustache | 2 +- .../JavaJaxRS/libraries/jersey1/formParams.mustache | 2 +- .../handlebars/JavaJaxRS/resteasy/eap/formParams.mustache | 2 +- .../JavaJaxRS/resteasy/eap/serviceFormParams.mustache | 2 +- .../handlebars/JavaJaxRS/resteasy/formParams.mustache | 2 +- .../handlebars/JavaJaxRS/resteasy/serviceFormParams.mustache | 2 +- .../resources/handlebars/JavaJaxRS/serviceFormParams.mustache | 2 +- .../resources/handlebars/JavaJaxRS/spec/formParams.mustache | 2 +- src/main/resources/handlebars/JavaSpring/api.mustache | 2 +- src/main/resources/handlebars/JavaSpring/apiDelegate.mustache | 2 +- src/main/resources/handlebars/JavaSpring/formParams.mustache | 2 +- .../JavaSpring/libraries/spring-cloud/formParams.mustache | 2 +- src/main/resources/handlebars/kotlin-client/api_doc.mustache | 2 +- src/main/resources/handlebars/kotlin-server/api_doc.mustache | 2 +- src/main/resources/handlebars/php/api.mustache | 4 ++-- src/main/resources/handlebars/php/api_doc.mustache | 2 +- .../handlebars/typescript-angular/api.service.mustache | 4 ++-- 30 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/main/resources/handlebars/Java/api_doc.mustache b/src/main/resources/handlebars/Java/api_doc.mustache index 386ea7f0c1..83f5cda199 100644 --- a/src/main/resources/handlebars/Java/api_doc.mustache +++ b/src/main/resources/handlebars/Java/api_doc.mustache @@ -62,7 +62,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#is this 'primitive-type'}}**{{dataType}}**{{/is}}{{#isNot this 'primitive-type'}}{{#is this 'file'}}**{{dataType}}**{{/is}}{{#isNot this 'file'}}[**{{dataType}}**]({{baseType}}.md){{/isNot}}{{/isNot}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#is this 'primitive-type'}}**{{dataType}}**{{/is}}{{#isNot this 'primitive-type'}}{{#is this 'binary'}}**{{dataType}}**{{/is}}{{#isNot this 'binary'}}[**{{dataType}}**]({{baseType}}.md){{/isNot}}{{/isNot}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/src/main/resources/handlebars/Java/libraries/retrofit/formParams.mustache b/src/main/resources/handlebars/Java/libraries/retrofit/formParams.mustache index 0bc9ea5159..0bfdce65cd 100644 --- a/src/main/resources/handlebars/Java/libraries/retrofit/formParams.mustache +++ b/src/main/resources/handlebars/Java/libraries/retrofit/formParams.mustache @@ -1 +1 @@ -{{~#is this 'form-param'}}{{#isNot this 'file'}}{{#is ../this 'multipart'}}@retrofit.http.Part{{/is}}{{#isNot ../this 'multipart'}}@retrofit.http.Field{{/isNot}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}}{{#is ../this 'multipart'}}@retrofit.http.Part{{/is}}{{#isNot ../this 'multipart'}}@retrofit.http.Field{{/isNot}}("{{baseName}}") TypedFile {{paramName}}{{/is}}{{/is}} \ No newline at end of file +{{~#is this 'form-param'}}{{#isNot this 'binary'}}{{#is ../this 'multipart'}}@retrofit.http.Part{{/is}}{{#isNot ../this 'multipart'}}@retrofit.http.Field{{/isNot}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}{{#is ../this 'multipart'}}@retrofit.http.Part{{/is}}{{#isNot ../this 'multipart'}}@retrofit.http.Field{{/isNot}}("{{baseName}}") TypedFile {{paramName}}{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/Java/libraries/retrofit2/formParams.mustache b/src/main/resources/handlebars/Java/libraries/retrofit2/formParams.mustache index b141e939b2..0b58db0b40 100644 --- a/src/main/resources/handlebars/Java/libraries/retrofit2/formParams.mustache +++ b/src/main/resources/handlebars/Java/libraries/retrofit2/formParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{#is this 'multipart'}}@retrofit2.http.Part{{/is}}{{#isNot this 'multipart'}}@retrofit2.http.Field{{/isNot}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}}{{#is this 'multipart'}}@retrofit2.http.Part{{/is}}{{#isNot this 'multipart'}}@retrofit2.http.Field{{/isNot}}{{#usePlayWS}} okhttp3.MultipartBody.Part {{/usePlayWS}}{{^usePlayWS}}("{{baseName}}\"; filename=\"{{baseName}}") RequestBody {{/usePlayWS}}{{paramName}}{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{#is this 'multipart'}}@retrofit2.http.Part{{/is}}{{#isNot this 'multipart'}}@retrofit2.http.Field{{/isNot}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}{{#is this 'multipart'}}@retrofit2.http.Part{{/is}}{{#isNot this 'multipart'}}@retrofit2.http.Field{{/isNot}}{{#usePlayWS}} okhttp3.MultipartBody.Part {{/usePlayWS}}{{^usePlayWS}}("{{baseName}}\"; filename=\"{{baseName}}") RequestBody {{/usePlayWS}}{{paramName}}{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaInflector/formParams.mustache b/src/main/resources/handlebars/JavaInflector/formParams.mustache index ae90ae4c74..414a56435d 100644 --- a/src/main/resources/handlebars/JavaInflector/formParams.mustache +++ b/src/main/resources/handlebars/JavaInflector/formParams.mustache @@ -1 +1 @@ - {{#is this 'form-param'}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#is this 'file'}}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}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/api.mustache b/src/main/resources/handlebars/JavaJaxRS/api.mustache index 1f7b8461dc..1d109d0b8b 100644 --- a/src/main/resources/handlebars/JavaJaxRS/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/api.mustache @@ -103,7 +103,7 @@ public class {{classname}} { {{/useOas2}} public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext) throws NotFoundException { - return delegate.{{nickname}}({{#allParams}}{{#is this 'file'}}{{paramName}}InputStream, {{paramName}}Detail{{/is}}{{#isNot this 'file'}}{{paramName}}{{/isNot}},{{/allParams}}securityContext); + return delegate.{{nickname}}({{#allParams}}{{#is this 'binary'}}{{paramName}}InputStream, {{paramName}}Detail{{/is}}{{#isNot this 'binary'}}{{paramName}}{{/isNot}},{{/allParams}}securityContext); } {{/operation}} } diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache index 0f03845652..ff66326cfe 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache @@ -78,7 +78,7 @@ public class {{classname}} { @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, content = @Content({{^containerType}}schema = @Schema(implementation = {{{baseType}}}.class)){{/containerType}}{{#containerType}}array = @ArraySchema(schema = @Schema(implementation = {{{baseType}}}.class))){{/containerType}}{{/vendorExtensions.x-java-is-response-void}}){{#has this 'more'}},{{/has}}{{/responses}} }) {{/useOas2}} public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#has this 'more'}}, {{/has}}{{/allParams}}) { - return delegate.{{nickname}}({{#allParams}}{{#is this 'file'}}{{paramName}}InputStream, {{paramName}}Detail{{/is}}{{#isNot this 'file'}}{{paramName}}{{/isNot}}, {{/allParams}}securityContext); + return delegate.{{nickname}}({{#allParams}}{{#is this 'binary'}}{{paramName}}InputStream, {{paramName}}Detail{{/is}}{{#isNot this 'binary'}}{{paramName}}{{/isNot}}, {{/allParams}}securityContext); } {{/operation}} } diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/formParams.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/formParams.mustache index 362ebd9bb3..44953d477e 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/formParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/formParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}} @Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) InputStream {{paramName}}InputStream, @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}} @Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) InputStream {{paramName}}InputStream, @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/serviceFormParams.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/serviceFormParams.mustache index d5294a8b96..4bf0ae7c29 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/serviceFormParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/serviceFormParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}}InputStream {{paramName}}InputStream, Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}InputStream {{paramName}}InputStream, Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache index 074c20054c..f855776ad5 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache @@ -113,7 +113,7 @@ public class {{classname}}Test { @Test public void {{operationId}}Test() { {{#allParams}} - {{#isNot this 'file'}}{{{dataType}}} {{paramName}} = null;{{/isNot}}{{#is this 'file'}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/is}} + {{#isNot this 'binary'}}{{{dataType}}} {{paramName}} = null;{{/isNot}}{{#is this 'binary'}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/is}} {{/allParams}} //{{^vendorExtensions.x-java-is-response-void}}{{>returnTypes}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#has this 'more'}}, {{/has}}{{/allParams}}); {{^vendorExtensions.x-java-is-response-void}}//assertNotNull(response);{{/vendorExtensions.x-java-is-response-void}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/formParams.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/formParams.mustache index 3a58a53af4..c3039d77ba 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/formParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/formParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}} @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}} @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/formParamsImpl.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/formParamsImpl.mustache index 2c42609fc8..1d683f5b40 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/formParamsImpl.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/formParamsImpl.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}} Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}} Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/di/api.mustache b/src/main/resources/handlebars/JavaJaxRS/di/api.mustache index b593427cf4..af3a0812a0 100644 --- a/src/main/resources/handlebars/JavaJaxRS/di/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/di/api.mustache @@ -87,7 +87,7 @@ public class {{classname}} { {{/useOas2}} public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext) throws NotFoundException { - return delegate.{{nickname}}({{#allParams}}{{#is this 'file'}}{{paramName}}InputStream, {{paramName}}Detail{{/is}}{{#isNot this 'file'}}{{paramName}}{{/isNot}},{{/allParams}}securityContext); + return delegate.{{nickname}}({{#allParams}}{{#is this 'binary'}}{{paramName}}InputStream, {{paramName}}Detail{{/is}}{{#isNot this 'binary'}}{{paramName}}{{/isNot}},{{/allParams}}securityContext); } {{/operation}} } diff --git a/src/main/resources/handlebars/JavaJaxRS/formParams.mustache b/src/main/resources/handlebars/JavaJaxRS/formParams.mustache index 0080b9b373..3843716cde 100644 --- a/src/main/resources/handlebars/JavaJaxRS/formParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/formParams.mustache @@ -1,2 +1,2 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{#useOas2}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/useOas2}}{{^useOas2}}@Parameter(description = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/useOas2}}{{/isNot}}{{#is this 'file'}}@FormDataParam("{{baseName}}") InputStream {{paramName}}InputStream, +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{#useOas2}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/useOas2}}{{^useOas2}}@Parameter(description = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/useOas2}}{{/isNot}}{{#is this 'binary'}}@FormDataParam("{{baseName}}") InputStream {{paramName}}InputStream, @FormDataParam("{{baseName}}") FormDataContentDisposition {{paramName}}Detail{{/is}}{{/is}} diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache index b4d4fe298a..8a89eab069 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache @@ -58,7 +58,7 @@ public class {{classname}} { {{/allParams}} @Context SecurityContext securityContext) throws NotFoundException { - return delegate.{{nickname}}({{#allParams}}{{#is this 'file'}}inputStream, fileDetail{{/is}}{{#isNot this 'file'}}{{paramName}}{{/isNot}},{{/allParams}}securityContext); + return delegate.{{nickname}}({{#allParams}}{{#is this 'binary'}}inputStream, fileDetail{{/is}}{{#isNot this 'binary'}}{{paramName}}{{/isNot}},{{/allParams}}securityContext); } {{/operation}} } diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/formParams.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/formParams.mustache index 9d505ebea4..d9b7151f76 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/formParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/formParams.mustache @@ -1,2 +1,2 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{#isNot this 'multipart'}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/isNot}}{{#is this 'multipart'}}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/is}}{{#isNot this 'multipart'}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{/isNot}}{{#is this 'file'}}@FormDataParam("{{baseName}}") InputStream inputStream, +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{#isNot this 'multipart'}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/isNot}}{{#is this 'multipart'}}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/is}}{{#isNot this 'multipart'}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{/isNot}}{{#is this 'binary'}}@FormDataParam("{{baseName}}") InputStream inputStream, @FormDataParam("{{baseName}}") FormDataContentDisposition fileDetail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/formParams.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/formParams.mustache index 8039a30433..bca3affc3d 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/formParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/formParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{#useOas2}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{^useOas2}}@Parameter(description = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{/isNot}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{#useOas2}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{^useOas2}}@Parameter(description = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{/isNot}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/serviceFormParams.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/serviceFormParams.mustache index 5bc6d7c5d4..72fe3e7ebe 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/serviceFormParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/serviceFormParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}}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}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/formParams.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/formParams.mustache index 8039a30433..bca3affc3d 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/formParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/formParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{#useOas2}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{^useOas2}}@Parameter(description = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{/isNot}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{#useOas2}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{^useOas2}}@Parameter(description = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/useOas2}}{{/isNot}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/serviceFormParams.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/serviceFormParams.mustache index 5bc6d7c5d4..72fe3e7ebe 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/serviceFormParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/serviceFormParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}}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}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/serviceFormParams.mustache b/src/main/resources/handlebars/JavaJaxRS/serviceFormParams.mustache index a88f3c0a18..06e6c0d0fd 100644 --- a/src/main/resources/handlebars/JavaJaxRS/serviceFormParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/serviceFormParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}}InputStream {{paramName}}InputStream, FormDataContentDisposition {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}{{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}}InputStream {{paramName}}InputStream, FormDataContentDisposition {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/spec/formParams.mustache b/src/main/resources/handlebars/JavaJaxRS/spec/formParams.mustache index b29f25b3ed..aeb477b05f 100644 --- a/src/main/resources/handlebars/JavaJaxRS/spec/formParams.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/spec/formParams.mustache @@ -1,2 +1,2 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}@FormParam(value = "{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'file'}} @FormParam(value = "{{baseName}}") InputStream {{paramName}}InputStream, +{{#is this 'form-param'}}{{#isNot this 'binary'}}@FormParam(value = "{{baseName}}") {{{dataType}}} {{paramName}}{{/isNot}}{{#is this 'binary'}} @FormParam(value = "{{baseName}}") InputStream {{paramName}}InputStream, @FormParam(value = "{{baseName}}") Attachment {{paramName}}Detail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaSpring/api.mustache b/src/main/resources/handlebars/JavaSpring/api.mustache index bd444d23df..c3c0fe5085 100644 --- a/src/main/resources/handlebars/JavaSpring/api.mustache +++ b/src/main/resources/handlebars/JavaSpring/api.mustache @@ -106,7 +106,7 @@ public interface {{classname}} { } // Override this method - default {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{#isNot this 'file'}}{{{dataType}}}{{/isNot}}{{#is this 'file'}}MultipartFile{{/is}} {{paramName}}{{#has this 'more'}},{{/has}}{{/allParams}}) { + default {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{#isNot this 'binary'}}{{{dataType}}}{{/isNot}}{{#is this 'binary'}}MultipartFile{{/is}} {{paramName}}{{#has this 'more'}},{{/has}}{{/allParams}}) { {{/delegate-method}} {{^isDelegate}} if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { diff --git a/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache b/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache index 1fdfcce87c..d9858cc7c3 100644 --- a/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache +++ b/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache @@ -61,7 +61,7 @@ public interface {{classname}}Delegate { /** * @see {{classname}}#{{operationId}} */ - {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{#isNot this 'file'}} {{>optionalDataType}} {{/isNot}}{{#is this 'file'}}MultipartFile{{/is}} {{paramName}}{{#has this 'more'}}, + {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{#isNot this 'binary'}} {{>optionalDataType}} {{/isNot}}{{#is this 'binary'}}MultipartFile{{/is}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { {{#examples}} diff --git a/src/main/resources/handlebars/JavaSpring/formParams.mustache b/src/main/resources/handlebars/JavaSpring/formParams.mustache index b534cb8a86..396b8b205d 100644 --- a/src/main/resources/handlebars/JavaSpring/formParams.mustache +++ b/src/main/resources/handlebars/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#is this 'form-param'}}{{#isNot this 'file'}}@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}}{{/isNot}}{{#is this 'file'}}@ApiParam(value = "file detail") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") MultipartFile {{baseName}}{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}@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}}{{/isNot}}{{#is this 'binary'}}@ApiParam(value = "file detail") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") MultipartFile {{baseName}}{{/is}}{{/is}} \ No newline at end of file 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 3e18227b6d..6bb90c784b 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 @@ -{{#is this 'form-param'}}{{#notFile}}@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}}{{/notFile}}{{#is this 'file'}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/is}}{{/is}} \ No newline at end of file +{{#is this 'form-param'}}{{#isNot this 'binary'}}@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}}{{/isNot}}{{#is this 'binary'}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/kotlin-client/api_doc.mustache b/src/main/resources/handlebars/kotlin-client/api_doc.mustache index e80c80e25b..9055d125ae 100644 --- a/src/main/resources/handlebars/kotlin-client/api_doc.mustache +++ b/src/main/resources/handlebars/kotlin-client/api_doc.mustache @@ -45,7 +45,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#is this 'primitiveType'}}**{{dataType}}**{{/is}}{{#isNot this 'primitiveType'}}{{#is this 'file'}}**{{dataType}}**{{/is}}{{#isNot this 'file'}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isNot}}{{/isNot}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#is this 'primitiveType'}}**{{dataType}}**{{/is}}{{#isNot this 'primitiveType'}}{{#is this 'binary'}}**{{dataType}}**{{/is}}{{#isNot this 'binary'}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isNot}}{{/isNot}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/src/main/resources/handlebars/kotlin-server/api_doc.mustache b/src/main/resources/handlebars/kotlin-server/api_doc.mustache index b8a85201c5..02fe0fe32b 100644 --- a/src/main/resources/handlebars/kotlin-server/api_doc.mustache +++ b/src/main/resources/handlebars/kotlin-server/api_doc.mustache @@ -45,7 +45,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#is this 'primitiveType'}}}**{{dataType}}**{{/is}}}{{#isNot this 'primitiveType'}}{{#is this 'file'}}**{{dataType}}**{{/is}}{{#isNot this 'file'}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isNot}}{{/isNot}}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#is this 'primitiveType'}}}**{{dataType}}**{{/is}}}{{#isNot this 'primitiveType'}}{{#is this 'binary'}}**{{dataType}}**{{/is}}{{#isNot this 'binary'}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isNot}}{{/isNot}}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/src/main/resources/handlebars/php/api.mustache b/src/main/resources/handlebars/php/api.mustache index d57ce12178..26a331aed0 100644 --- a/src/main/resources/handlebars/php/api.mustache +++ b/src/main/resources/handlebars/php/api.mustache @@ -398,11 +398,11 @@ use {{invokerPackage}}\ObjectSerializer; {{#formParams~}} // form params if (${{paramName}} !== null) { - {{#is this 'file'}} + {{#is this 'binary'}} $multipart = true; $formParams['{{baseName}}'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue(${{paramName}}), 'rb'); {{/is}} - {{#isNot this 'file'}} + {{#isNot this 'binary'}} $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); {{/isNot}} } diff --git a/src/main/resources/handlebars/php/api_doc.mustache b/src/main/resources/handlebars/php/api_doc.mustache index f836ed72d0..6328fe5910 100644 --- a/src/main/resources/handlebars/php/api_doc.mustache +++ b/src/main/resources/handlebars/php/api_doc.mustache @@ -57,7 +57,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#is this 'file'}}**{{dataType}}**{{/is}}{{#is this 'primitive-type'}}**{{dataType}}**{{/is}}{{#isNot this 'primitive-type'}}{{#isNot this 'file'}}[**{{dataType}}**](../Model/{{baseType}}.md){{/isNot}}{{/isNot}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}} +{{#allParams}} **{{paramName}}** | {{#is this 'binary'}}**{{dataType}}**{{/is}}{{#is this 'primitive-type'}}**{{dataType}}**{{/is}}{{#isNot this 'primitive-type'}}{{#isNot this 'binary'}}[**{{dataType}}**](../Model/{{baseType}}.md){{/isNot}}{{/isNot}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}} {{/allParams}} ### Return type diff --git a/src/main/resources/handlebars/typescript-angular/api.service.mustache b/src/main/resources/handlebars/typescript-angular/api.service.mustache index 0a600b403b..246939e1ff 100644 --- a/src/main/resources/handlebars/typescript-angular/api.service.mustache +++ b/src/main/resources/handlebars/typescript-angular/api.service.mustache @@ -249,11 +249,11 @@ export class {{classname}} { let useForm = false; let convertFormParamsToString = false; {{#formParams}} -{{#isFile}} +{{#is this 'binary'}} // use FormData to transmit files using content-type "multipart/form-data" // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data useForm = canConsumeForm; -{{/isFile}} +{{/is}} {{/formParams}} if (useForm) { formParams = new FormData(); From 570d94b6c366681fc3eb15a2c8bf758bad071930 Mon Sep 17 00:00:00 2001 From: Olivier Samyn Date: Fri, 3 May 2019 10:56:13 +0200 Subject: [PATCH 5/7] Add vendor extension for binary types --- .../io/swagger/codegen/v3/generators/DefaultCodegenConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java index c4370ab9bf..b535e894e3 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java +++ b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java @@ -2408,6 +2408,8 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) codegenProperty = codegenProperty.items; } collectionFormat = getCollectionFormat(parameter); + } else if (parameterSchema instanceof BinarySchema) { + codegenParameter.getVendorExtensions().put(CodegenConstants.IS_BINARY_EXT_NAME, Boolean.TRUE); } else if (parameterSchema instanceof FileSchema) { codegenParameter.getVendorExtensions().put(CodegenConstants.IS_FILE_EXT_NAME, Boolean.TRUE); } From b6ef054d3550c4362236b350867792ddd29f5966 Mon Sep 17 00:00:00 2001 From: Olivier Samyn Date: Fri, 3 May 2019 11:15:51 +0200 Subject: [PATCH 6/7] In templates, replace *isFile and *notFile with *isBinary and *notBinary Automated replacement with the following sed command: sed -i -re "s/\\{\\{([/#^](is|not))File\\}\\}/{{\1Binary}}/g" $FILENAME --- .../handlebars/JavaInflector/formParams.mustache | 2 +- src/main/resources/handlebars/JavaJaxRS/api.mustache | 2 +- .../resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache | 2 +- .../resources/handlebars/JavaJaxRS/cxf/api_test.mustache | 2 +- src/main/resources/handlebars/JavaJaxRS/di/api.mustache | 2 +- .../handlebars/JavaJaxRS/libraries/jersey1/api.mustache | 2 +- src/main/resources/handlebars/JavaSpring/api.mustache | 2 +- .../resources/handlebars/JavaSpring/apiDelegate.mustache | 2 +- .../resources/handlebars/JavaSpring/formParams.mustache | 2 +- .../JavaSpring/libraries/spring-boot/api_test.mustache | 8 ++++---- .../JavaSpring/libraries/spring-cloud/api_test.mustache | 8 ++++---- .../JavaSpring/libraries/spring-cloud/formParams.mustache | 2 +- src/main/resources/handlebars/csharp-dotnet2/api.mustache | 2 +- .../resources/handlebars/csharp-dotnet2/api_doc.mustache | 2 +- src/main/resources/handlebars/csharp/api.mustache | 4 ++-- src/main/resources/handlebars/csharp/api_doc.mustache | 2 +- .../resources/handlebars/kotlin-client/api_doc.mustache | 2 +- .../resources/handlebars/kotlin-server/api_doc.mustache | 2 +- src/main/resources/handlebars/php/api.mustache | 8 ++++---- src/main/resources/handlebars/php/api_doc.mustache | 2 +- src/main/resources/handlebars/python/api.mustache | 2 +- src/main/resources/handlebars/python/api_doc.mustache | 2 +- .../handlebars/typescript-angular/api.service.mustache | 4 ++-- 23 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/main/resources/handlebars/JavaInflector/formParams.mustache b/src/main/resources/handlebars/JavaInflector/formParams.mustache index ae90ae4c74..74569bced6 100644 --- a/src/main/resources/handlebars/JavaInflector/formParams.mustache +++ b/src/main/resources/handlebars/JavaInflector/formParams.mustache @@ -1 +1 @@ - {{#is this 'form-param'}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#is this 'file'}}FormDataContentDisposition fileDetail{{/is}}{{/is}} \ No newline at end of file + {{#is this 'form-param'}}{{#notBinary}}{{{dataType}}} {{paramName}}{{/notBinary}}{{#is this 'file'}}FormDataContentDisposition fileDetail{{/is}}{{/is}} \ No newline at end of file diff --git a/src/main/resources/handlebars/JavaJaxRS/api.mustache b/src/main/resources/handlebars/JavaJaxRS/api.mustache index 39489320ec..4952994065 100644 --- a/src/main/resources/handlebars/JavaJaxRS/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/api.mustache @@ -105,7 +105,7 @@ public class {{classname}} { {{/useOas2}} public Response {{nickname}}({{#parameters}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/parameters}}@Context SecurityContext securityContext) throws NotFoundException { - return delegate.{{nickname}}({{#parameters}}{{#isFile}}{{paramName}}InputStream, {{paramName}}Detail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/parameters}}securityContext); + return delegate.{{nickname}}({{#parameters}}{{#isBinary}}{{paramName}}InputStream, {{paramName}}Detail{{/isBinary}}{{^isBinary}}{{paramName}}{{/isBinary}},{{/parameters}}securityContext); } {{/contents}} {{/operation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache index 1fa6183916..ab7a73c029 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache @@ -79,7 +79,7 @@ public class {{classname}} { @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, content = @Content({{^containerType}}schema = @Schema(implementation = {{{baseType}}}.class)){{/containerType}}{{#containerType}}array = @ArraySchema(schema = @Schema(implementation = {{{baseType}}}.class))){{/containerType}}{{/vendorExtensions.x-java-is-response-void}}){{#hasMore}},{{/hasMore}}{{/responses}} }) {{/useOas2}} public Response {{nickname}}({{#parameters}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/parameters}}) { - return delegate.{{nickname}}({{#parameters}}{{#isFile}}{{paramName}}InputStream, {{paramName}}Detail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}, {{/parameters}}securityContext); + return delegate.{{nickname}}({{#parameters}}{{#isBinary}}{{paramName}}InputStream, {{paramName}}Detail{{/isBinary}}{{^isBinary}}{{paramName}}{{/isBinary}}, {{/parameters}}securityContext); } {{/contents}} {{/operation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache index 5194af8457..e265b96996 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache @@ -113,7 +113,7 @@ public class {{classname}}Test { @Test public void {{operationId}}Test() { {{#parameters}} - {{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}} + {{^isBinary}}{{{dataType}}} {{paramName}} = null;{{/isBinary}}{{#isBinary}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isBinary}} {{/parameters}} //{{^vendorExtensions.x-java-is-response-void}}{{>returnTypes}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#parameters}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}); {{^vendorExtensions.x-java-is-response-void}}//assertNotNull(response);{{/vendorExtensions.x-java-is-response-void}} diff --git a/src/main/resources/handlebars/JavaJaxRS/di/api.mustache b/src/main/resources/handlebars/JavaJaxRS/di/api.mustache index 6ac2b09fbf..bc714ba145 100644 --- a/src/main/resources/handlebars/JavaJaxRS/di/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/di/api.mustache @@ -88,7 +88,7 @@ public class {{classname}} { {{/useOas2}} public Response {{nickname}}({{#parameters}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/parameters}}@Context SecurityContext securityContext) throws NotFoundException { - return delegate.{{nickname}}({{#parameters}}{{#isFile}}{{paramName}}InputStream, {{paramName}}Detail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/parameters}}securityContext); + return delegate.{{nickname}}({{#parameters}}{{#isBinary}}{{paramName}}InputStream, {{paramName}}Detail{{/isBinary}}{{^isBinary}}{{paramName}}{{/isBinary}},{{/parameters}}securityContext); } {{/contents}} {{/operation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache index f71a06d9bc..563bf5077b 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/api.mustache @@ -57,7 +57,7 @@ public class {{classname}} { {{#parameters}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}, {{/parameters}}@Context SecurityContext securityContext) throws NotFoundException { - return delegate.{{nickname}}({{#parameters}}{{#isFile}}inputStream, fileDetail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/parameters}}securityContext); + return delegate.{{nickname}}({{#parameters}}{{#isBinary}}inputStream, fileDetail{{/isBinary}}{{^isBinary}}{{paramName}}{{/isBinary}},{{/parameters}}securityContext); } {{/contents}} {{/operation}} diff --git a/src/main/resources/handlebars/JavaSpring/api.mustache b/src/main/resources/handlebars/JavaSpring/api.mustache index 7551be6b6f..b84a5ccf64 100644 --- a/src/main/resources/handlebars/JavaSpring/api.mustache +++ b/src/main/resources/handlebars/JavaSpring/api.mustache @@ -108,7 +108,7 @@ public interface {{classname}} { } // Override this method - default {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#parameters}}{{^isFile}}{{{dataType}}}{{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}},{{/hasMore}}{{/parameters}}) { + default {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#parameters}}{{^isBinary}}{{{dataType}}}{{/isBinary}}{{#isBinary}}MultipartFile{{/isBinary}} {{paramName}}{{#hasMore}},{{/hasMore}}{{/parameters}}) { {{/delegate-method}} {{^isDelegate}} if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { diff --git a/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache b/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache index c75596caea..e33a9a4880 100644 --- a/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache +++ b/src/main/resources/handlebars/JavaSpring/apiDelegate.mustache @@ -63,7 +63,7 @@ public interface {{classname}}Delegate { /** * @see {{classname}}#{{operationId}} */ - {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#parameters}}{{^isFile}} {{>optionalDataType}} {{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}}, + {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#parameters}}{{^isBinary}} {{>optionalDataType}} {{/isBinary}}{{#isBinary}}MultipartFile{{/isBinary}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { {{#examples}} diff --git a/src/main/resources/handlebars/JavaSpring/formParams.mustache b/src/main/resources/handlebars/JavaSpring/formParams.mustache index f9c3e502b8..502a729c8b 100644 --- a/src/main/resources/handlebars/JavaSpring/formParams.mustache +++ b/src/main/resources/handlebars/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{#notFile}}@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}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{#notBinary}}@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}}{{/notBinary}}{{#isBinary}}@ApiParam(value = "file detail") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") MultipartFile {{baseName}}{{/isBinary}}{{/isFormParam}} \ No newline at end of file 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 bd2cb8bb64..7228622348 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}}{{#notFile}}@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}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{#notBinary}}@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}}{{/notBinary}}{{#isBinary}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/isBinary}}{{/isFormParam}} \ No newline at end of file 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 37ebf9834b..a55c8d848d 100644 --- a/src/main/resources/handlebars/csharp/api.mustache +++ b/src/main/resources/handlebars/csharp/api.mustache @@ -242,7 +242,7 @@ namespace {{packageName}}.{{apiPackage}} if ({{paramName}} != null) localVarHeaderParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToString({{paramName}})); // header parameter {{/headerParams}} {{#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}} {{#bodyParam}} if ({{paramName}} != null && {{paramName}}.GetType() != typeof(byte[])) @@ -378,7 +378,7 @@ namespace {{packageName}}.{{apiPackage}} if ({{paramName}} != null) localVarHeaderParams.Add("{{baseName}}", this.Configuration.ApiClient.ParameterToString({{paramName}})); // header parameter {{/headerParams}} {{#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}} {{#bodyParam}} if ({{paramName}} != null && {{paramName}}.GetType() != typeof(byte[])) 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/kotlin-client/api_doc.mustache b/src/main/resources/handlebars/kotlin-client/api_doc.mustache index b390671f68..0ade39e394 100644 --- a/src/main/resources/handlebars/kotlin-client/api_doc.mustache +++ b/src/main/resources/handlebars/kotlin-client/api_doc.mustache @@ -46,7 +46,7 @@ try { {{^parameters}}This endpoint does not need any parameter.{{/parameters}}{{#parameters}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/parameters}} -{{#parameters}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} +{{#parameters}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isBinary}}**{{dataType}}**{{/isBinary}}{{^isBinary}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isBinary}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} {{/parameters}} ### Return type diff --git a/src/main/resources/handlebars/kotlin-server/api_doc.mustache b/src/main/resources/handlebars/kotlin-server/api_doc.mustache index eb212243df..634a196a0b 100644 --- a/src/main/resources/handlebars/kotlin-server/api_doc.mustache +++ b/src/main/resources/handlebars/kotlin-server/api_doc.mustache @@ -46,7 +46,7 @@ try { {{^parameters}}This endpoint does not need any parameter.{{/parameters}}{{#parameters}}{{#@last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/@last}}{{/parameters}} -{{#parameters}} **{{paramName}}** | {{#isPrimitiveType}}}**{{dataType}}**{{/is}}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} +{{#parameters}} **{{paramName}}** | {{#isPrimitiveType}}}**{{dataType}}**{{/is}}}{{^isPrimitiveType}}{{#isBinary}}**{{dataType}}**{{/isBinary}}{{^isBinary}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isBinary}}{{/isPrimitiveType}}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^@last}}, {{/@last}}{{/values}}]{{/allowableValues}} {{/parameters}} ### Return type diff --git a/src/main/resources/handlebars/php/api.mustache b/src/main/resources/handlebars/php/api.mustache index d7e89f4000..39c1888899 100644 --- a/src/main/resources/handlebars/php/api.mustache +++ b/src/main/resources/handlebars/php/api.mustache @@ -395,13 +395,13 @@ use {{invokerPackage}}\ObjectSerializer; {{#formParams}} // form params if (${{paramName}} !== null) { - {{#isFile}} + {{#isBinary}} $multipart = true; $formParams['{{baseName}}'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue(${{paramName}}), 'rb'); - {{/isFile}} - {{^isFile}} + {{/isBinary}} + {{^isBinary}} $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); - {{/isFile}} + {{/isBinary}} } {{/formParams}} // body params diff --git a/src/main/resources/handlebars/php/api_doc.mustache b/src/main/resources/handlebars/php/api_doc.mustache index 1780b676e8..412f074573 100644 --- a/src/main/resources/handlebars/php/api_doc.mustache +++ b/src/main/resources/handlebars/php/api_doc.mustache @@ -58,7 +58,7 @@ try { {{^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}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}} +{{#parameters}} **{{paramName}}** | {{#isBinary}}**{{dataType}}**{{/isBinary}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isBinary}}[**{{dataType}}**](../Model/{{baseType}}.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 diff --git a/src/main/resources/handlebars/typescript-angular/api.service.mustache b/src/main/resources/handlebars/typescript-angular/api.service.mustache index e4c590828c..85c4f8c5b4 100644 --- a/src/main/resources/handlebars/typescript-angular/api.service.mustache +++ b/src/main/resources/handlebars/typescript-angular/api.service.mustache @@ -269,11 +269,11 @@ export class {{classname}} { let useForm = false; let convertFormParamsToString = false; {{#formParams}} -{{#isFile}} +{{#isBinary}} // use FormData to transmit files using content-type "multipart/form-data" // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data useForm = canConsumeForm; -{{/isFile}} +{{/isBinary}} {{/formParams}} if (useForm) { formParams = new FormData(); From e3bbec49605993e9009f57475ae1c6eb8b60f492 Mon Sep 17 00:00:00 2001 From: frantuma Date: Fri, 27 Dec 2019 17:46:52 +0100 Subject: [PATCH 7/7] fix html generator for composed schema properties --- .../v3/generators/html/HtmlSchemaHandler.java | 135 ++++++++++++++++++ .../v3/generators/html/StaticHtmlCodegen.java | 3 +- .../handlebars/htmlDocs/index.mustache | 30 ++++ 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 src/main/java/io/swagger/codegen/v3/generators/html/HtmlSchemaHandler.java diff --git a/src/main/java/io/swagger/codegen/v3/generators/html/HtmlSchemaHandler.java b/src/main/java/io/swagger/codegen/v3/generators/html/HtmlSchemaHandler.java new file mode 100644 index 0000000000..8748a79208 --- /dev/null +++ b/src/main/java/io/swagger/codegen/v3/generators/html/HtmlSchemaHandler.java @@ -0,0 +1,135 @@ +package io.swagger.codegen.v3.generators.html; + +import io.swagger.codegen.v3.CodegenModel; +import io.swagger.codegen.v3.CodegenModelFactory; +import io.swagger.codegen.v3.CodegenModelType; +import io.swagger.codegen.v3.CodegenProperty; +import io.swagger.codegen.v3.generators.DefaultCodegenConfig; +import io.swagger.codegen.v3.generators.SchemaHandler; +import io.swagger.codegen.v3.generators.util.OpenAPIUtil; +import io.swagger.v3.oas.models.media.ComposedSchema; +import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class HtmlSchemaHandler extends SchemaHandler { + + public HtmlSchemaHandler(DefaultCodegenConfig codegenConfig) { + super(codegenConfig); + } + + + public void createCodegenModel(ComposedSchema composedProperty, CodegenProperty codegenProperty) { + final List oneOf = composedProperty.getOneOf(); + final List anyOf = composedProperty.getAnyOf(); + + if (oneOf != null && !oneOf.isEmpty()) { + if (!hasNonObjectSchema(oneOf)) { + final CodegenModel oneOfModel = createFromOneOfSchemas(oneOf); + codegenProperty.vendorExtensions.put("oneOf-model", oneOfModel); + } + } + if (anyOf != null && !anyOf.isEmpty()) { + if (!hasNonObjectSchema(anyOf)) { + final CodegenModel anyOfModel = createFromOneOfSchemas(anyOf); + codegenProperty.vendorExtensions.put("anyOf-model", anyOfModel); + } + } + + } + + public void configureComposedModelFromSchemaItems(CodegenModel codegenModel, ComposedSchema items) { + List oneOfList = items.getOneOf(); + if (oneOfList != null && !oneOfList.isEmpty()){ + String name = "OneOf" + codegenModel.name + "Items"; + final CodegenModel oneOfModel = createComposedModel(name); + // setting name to be used as instance type on composed model. + items.addExtension("x-model-name", codegenConfig.toModelName(name)); + + final List modelNames = new ArrayList<>(); + for (Schema interfaceSchema : oneOfList) { + if (StringUtils.isNotBlank(interfaceSchema.get$ref())) { + String schemaName = OpenAPIUtil.getSimpleRef(interfaceSchema.get$ref()); + modelNames.add(codegenConfig.toModelName(schemaName)); + } + } + oneOfModel.vendorExtensions.put("x-model-names", modelNames); + if (!modelNames.isEmpty()) { + codegenModel.vendorExtensions.put("oneOf-model", oneOfModel); + } + } + List anyOfList = items.getAnyOf(); + if (anyOfList != null && !anyOfList.isEmpty()){ + String name = "AnyOf" + codegenModel.name + "Items"; + final CodegenModel anyOfModel = createComposedModel(name); + items.addExtension("x-model-name", codegenConfig.toModelName(name)); + + final List modelNames = new ArrayList<>(); + for (Schema interfaceSchema : anyOfList) { + if (StringUtils.isNotBlank(interfaceSchema.get$ref())) { + String schemaName = OpenAPIUtil.getSimpleRef(interfaceSchema.get$ref()); + modelNames.add(codegenConfig.toModelName(schemaName)); + } + } + anyOfModel.vendorExtensions.put("x-model-names", modelNames); + if (!modelNames.isEmpty()) { + codegenModel.vendorExtensions.put("anyOf-model", anyOfModel); + } + } + } + + public void configureOneOfModel(CodegenModel codegenModel, List oneOf) { + // no ops for html generator + } + + public void configureAnyOfModel(CodegenModel codegenModel, List anyOf) { + // no ops for html generator + } + + public void configureOneOfModelFromProperty(CodegenProperty codegenProperty, CodegenModel codegenModel) { + // no ops for html generator + } + + public void configureAnyOfModelFromProperty(CodegenProperty codegenProperty, CodegenModel codegenModel) { + // no ops for html generator + } + + private CodegenModel createFromOneOfSchemas(List schemas) { + final CodegenModel codegenModel = CodegenModelFactory.newInstance(CodegenModelType.MODEL); + final List modelNames = new ArrayList<>(); + + for (Schema interfaceSchema : schemas) { + if (StringUtils.isNotBlank(interfaceSchema.get$ref())) { + String schemaName = OpenAPIUtil.getSimpleRef(interfaceSchema.get$ref()); + modelNames.add(codegenConfig.toModelName(schemaName)); + } + } + codegenModel.vendorExtensions.put("x-model-names", modelNames); + return codegenModel; + } + + private CodegenModel createComposedModel(String name) { + final CodegenModel composedModel = CodegenModelFactory.newInstance(CodegenModelType.MODEL); + this.configureModel(composedModel, name); + return composedModel; + } + + private void configureModel(CodegenModel codegenModel, String name) { + codegenModel.name = name; + codegenModel.classname = codegenConfig.toModelName(name); + codegenModel.classVarName = codegenConfig.toVarName(name); + codegenModel.classFilename = codegenConfig.toModelFilename(name); + codegenModel.vendorExtensions.put("x-is-composed-model", Boolean.TRUE); + } + + private boolean hasNonObjectSchema(List schemas) { + for (Schema schema : schemas) { + if (!codegenConfig.isObjectSchema(schema)) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/io/swagger/codegen/v3/generators/html/StaticHtmlCodegen.java b/src/main/java/io/swagger/codegen/v3/generators/html/StaticHtmlCodegen.java index 2a50d45985..d6f8ee140b 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/html/StaticHtmlCodegen.java +++ b/src/main/java/io/swagger/codegen/v3/generators/html/StaticHtmlCodegen.java @@ -32,6 +32,7 @@ public class StaticHtmlCodegen extends DefaultCodegenConfig { public StaticHtmlCodegen() { super(); + schemaHandler = new HtmlSchemaHandler(this); outputFolder = "docs"; defaultIncludes = new HashSet(); @@ -155,7 +156,7 @@ public String escapeUnsafeCharacters(String input) { /** * Convert Markdown text to HTML - * + * * @param input * text in Markdown; may be null. * @return the text, converted to Markdown. For null input, "" is returned. diff --git a/src/main/resources/handlebars/htmlDocs/index.mustache b/src/main/resources/handlebars/htmlDocs/index.mustache index 3130275287..59b27c891a 100644 --- a/src/main/resources/handlebars/htmlDocs/index.mustache +++ b/src/main/resources/handlebars/htmlDocs/index.mustache @@ -174,6 +174,36 @@ {{#example}}
example: {{example}}
{{/example}} + {{#vendorExtensions.oneOf-model}} +
oneOf: + {{#vendorExtensions.x-model-names}} + {{this}}    + {{/vendorExtensions.x-model-names}} +
+ {{/vendorExtensions.oneOf-model}} + {{#vendorExtensions.anyOf-model}} +
anyOf: + {{#vendorExtensions.x-model-names}} + {{this}}    + {{/vendorExtensions.x-model-names}} +
+ {{/vendorExtensions.anyOf-model}} + {{#items}} + {{#vendorExtensions.oneOf-model}} +
items oneOf: + {{#vendorExtensions.x-model-names}} + {{this}}    + {{/vendorExtensions.x-model-names}} +
+ {{/vendorExtensions.oneOf-model}} + {{#vendorExtensions.anyOf-model}} +
items anyOf: + {{#vendorExtensions.x-model-names}} + {{this}}    + {{/vendorExtensions.x-model-names}} +
+ {{/vendorExtensions.anyOf-model}} + {{/items}} {{/vars}}