From 8f2f2c80b34b66ac67e696fc8e70c39638d99414 Mon Sep 17 00:00:00 2001 From: Junfeng Qiao Date: Thu, 19 Dec 2024 14:47:08 +0100 Subject: [PATCH 1/2] Fix Julia template for binary format --- .../src/main/resources/julia-client/api.mustache | 4 ++-- .../src/main/resources/julia-server/api_doc.mustache | 2 +- .../src/main/resources/julia-server/server.mustache | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/julia-client/api.mustache b/modules/openapi-generator/src/main/resources/julia-client/api.mustache index e1aaa06369ff..512b5e8074ff 100644 --- a/modules/openapi-generator/src/main/resources/julia-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/julia-client/api.mustache @@ -22,7 +22,7 @@ const _returntypes_{{operationId}}_{{classname}} = Dict{Regex,Type}( {{/responses}} ) -function _oacinternal_{{operationId}}(_api::{{classname}}{{#allParams}}{{#required}}, {{paramName}}::{{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing) +function _oacinternal_{{operationId}}(_api::{{classname}}{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing) {{#allParams}} {{#hasValidation}} {{#maxLength}} @@ -61,7 +61,7 @@ function _oacinternal_{{operationId}}(_api::{{classname}}{{#allParams}}{{#requir OpenAPI.Clients.set_param(_ctx.form, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}}) # type {{dataType}} {{/isFile}} {{#isFile}} - OpenAPI.Clients.set_param(_ctx.file, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}) # type {{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}} + OpenAPI.Clients.set_param(_ctx.file, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}) # type {{dataType}} {{/isFile}} {{/formParams}} OpenAPI.Clients.set_header_accept(_ctx, [{{#produces}}"{{{mediaType}}}", {{/produces}}]) diff --git a/modules/openapi-generator/src/main/resources/julia-server/api_doc.mustache b/modules/openapi-generator/src/main/resources/julia-server/api_doc.mustache index 1595704fa317..16781e3e4247 100644 --- a/modules/openapi-generator/src/main/resources/julia-server/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/julia-server/api_doc.mustache @@ -11,7 +11,7 @@ Method | HTTP request | Description {{#operations}} {{#operation}} # **{{{operationId}}}** -> {{operationId}}(req::HTTP.Request{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}}) -> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}} +> {{operationId}}(req::HTTP.Request{{#allParams}}{{#required}}, {{paramName}}::{{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}}) -> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}} {{{summary}}}{{#notes}} diff --git a/modules/openapi-generator/src/main/resources/julia-server/server.mustache b/modules/openapi-generator/src/main/resources/julia-server/server.mustache index 3b075eaf5a50..fa43321c2653 100644 --- a/modules/openapi-generator/src/main/resources/julia-server/server.mustache +++ b/modules/openapi-generator/src/main/resources/julia-server/server.mustache @@ -11,7 +11,7 @@ The following server methods must be implemented: {{#operation}} - **{{operationId}}** - *invocation:* {{httpMethod}} {{{path}}} - - *signature:* {{operationId}}(req::HTTP.Request{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}}) -> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}} + - *signature:* {{operationId}}(req::HTTP.Request{{#allParams}}{{#required}}, {{paramName}}::{{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}}) -> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}} {{/operation}} {{/operations}} {{/apis}} From 2ea1d2f42884667d2f4e323f87a2d272b7ce7f04 Mon Sep 17 00:00:00 2001 From: Junfeng Qiao Date: Thu, 19 Dec 2024 17:23:40 +0100 Subject: [PATCH 2/2] Update julia samples --- samples/client/petstore/julia/src/apis/api_PetApi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/client/petstore/julia/src/apis/api_PetApi.jl b/samples/client/petstore/julia/src/apis/api_PetApi.jl index 55d2658b4e4a..13126f05d1b4 100644 --- a/samples/client/petstore/julia/src/apis/api_PetApi.jl +++ b/samples/client/petstore/julia/src/apis/api_PetApi.jl @@ -248,7 +248,7 @@ function _oacinternal_upload_file(_api::PetApi, pet_id::Int64; additional_metada _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_upload_file_PetApi, "/pet/{petId}/uploadImage", ["petstore_auth", ]) OpenAPI.Clients.set_param(_ctx.path, "petId", pet_id) # type Int64 OpenAPI.Clients.set_param(_ctx.form, "additionalMetadata", additional_metadata) # type String - OpenAPI.Clients.set_param(_ctx.file, "file", file) # type Vector{UInt8} + OpenAPI.Clients.set_param(_ctx.file, "file", file) # type String OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["multipart/form-data", ] : [_mediaType]) return _ctx