Skip to content

Commit 3c88071

Browse files
authored
[julia] Add support for style, explode in query params (#19238)
* set style and explode * update client * fix * set the newer version
1 parent fb023b1 commit 3c88071

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

.github/workflows/samples-julia.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
# Using develop mode to install package so that it is easier to modify the package test files
3131
julia -e "using Pkg; Pkg.develop(\"OpenAPI\");"
3232
cd ~/.julia/dev/OpenAPI
33-
git checkout v0.1.14
33+
git checkout v0.1.25
3434
cd $currdir
3535
rm -rf ~/.julia/dev/OpenAPI/test/client/openapigenerator_petstore_v3/petstore
3636
rm -rf ~/.julia/dev/OpenAPI/test/server/openapigenerator_petstore_v3/petstore

modules/openapi-generator/src/main/resources/julia-client/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function _oacinternal_{{operationId}}(_api::{{classname}}{{#allParams}}{{#requir
5151
OpenAPI.Clients.set_param(_ctx.path, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}}) # type {{dataType}}
5252
{{/pathParams}}
5353
{{#queryParams}}
54-
OpenAPI.Clients.set_param(_ctx.query, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}}) # type {{dataType}}
54+
OpenAPI.Clients.set_param(_ctx.query, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}; style="{{style}}", is_explode={{isExplode}}{{#isListContainer}},collection_format="{{collectionFormat}}"{{/isListContainer}}) # type {{dataType}}
5555
{{/queryParams}}
5656
{{#headerParams}}
5757
OpenAPI.Clients.set_param(_ctx.header, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}}) # type {{dataType}}

modules/openapi-generator/src/main/resources/julia-server/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function {{operationId}}_read(handler)
88
path_params = HTTP.getparams(req){{#pathParams}}
99
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param({{dataType}}, path_params, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#required}}required=true, {{/required}}{{#isListContainer}}collection_format="{{collectionFormat}}", {{/isListContainer}}){{/pathParams}}{{/hasPathParams}}{{#hasQueryParams}}
1010
query_params = HTTP.queryparams(URIs.URI(req.target)){{#queryParams}}
11-
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param({{dataType}}, query_params, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#required}}required=true, {{/required}}{{#isListContainer}}collection_format="{{collectionFormat}}", {{/isListContainer}}){{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}}
11+
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param({{dataType}}, query_params, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#required}}required=true, {{/required}}style="{{style}}", is_explode={{isExplode}}{{#isListContainer}},collection_format="{{collectionFormat}}"{{/isListContainer}}){{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}}
1212
headers = Dict{String,String}(HTTP.headers(req)){{#headerParams}}
1313
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param({{dataType}}, headers, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#required}}required=true, {{/required}}{{#isListContainer}}collection_format="{{collectionFormat}}", {{/isListContainer}}){{/headerParams}}{{/hasHeaderParams}}{{#hasBodyParam}}{{#bodyParams}}
1414
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param_type({{dataType}}, String(req.body)){{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}

samples/client/petstore/julia/src/apis/api_PetApi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const _returntypes_find_pets_by_status_PetApi = Dict{Regex,Type}(
8282

8383
function _oacinternal_find_pets_by_status(_api::PetApi, status::Vector{String}; _mediaType=nothing)
8484
_ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_find_pets_by_status_PetApi, "/pet/findByStatus", ["petstore_auth", ])
85-
OpenAPI.Clients.set_param(_ctx.query, "status", status) # type Vector{String}
85+
OpenAPI.Clients.set_param(_ctx.query, "status", status; style="form", is_explode=false) # type Vector{String}
8686
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
8787
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
8888
return _ctx
@@ -114,7 +114,7 @@ const _returntypes_find_pets_by_tags_PetApi = Dict{Regex,Type}(
114114

115115
function _oacinternal_find_pets_by_tags(_api::PetApi, tags::Vector{String}; _mediaType=nothing)
116116
_ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_find_pets_by_tags_PetApi, "/pet/findByTags", ["petstore_auth", ])
117-
OpenAPI.Clients.set_param(_ctx.query, "tags", tags) # type Vector{String}
117+
OpenAPI.Clients.set_param(_ctx.query, "tags", tags; style="form", is_explode=false) # type Vector{String}
118118
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
119119
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
120120
return _ctx

samples/client/petstore/julia/src/apis/api_UserApi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ const _returntypes_login_user_UserApi = Dict{Regex,Type}(
174174
function _oacinternal_login_user(_api::UserApi, username::String, password::String; _mediaType=nothing)
175175

176176
_ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_login_user_UserApi, "/user/login", [])
177-
OpenAPI.Clients.set_param(_ctx.query, "username", username) # type String
178-
OpenAPI.Clients.set_param(_ctx.query, "password", password) # type String
177+
OpenAPI.Clients.set_param(_ctx.query, "username", username; style="form", is_explode=true) # type String
178+
OpenAPI.Clients.set_param(_ctx.query, "password", password; style="form", is_explode=true) # type String
179179
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
180180
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
181181
return _ctx

samples/server/petstore/julia/src/apis/api_PetApi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function find_pets_by_status_read(handler)
6363
function find_pets_by_status_read_handler(req::HTTP.Request)
6464
openapi_params = Dict{String,Any}()
6565
query_params = HTTP.queryparams(URIs.URI(req.target))
66-
openapi_params["status"] = OpenAPI.Servers.to_param(Vector{String}, query_params, "status", required=true, )
66+
openapi_params["status"] = OpenAPI.Servers.to_param(Vector{String}, query_params, "status", required=true, style="form", is_explode=false)
6767
req.context[:openapi_params] = openapi_params
6868

6969
return handler(req)
@@ -91,7 +91,7 @@ function find_pets_by_tags_read(handler)
9191
function find_pets_by_tags_read_handler(req::HTTP.Request)
9292
openapi_params = Dict{String,Any}()
9393
query_params = HTTP.queryparams(URIs.URI(req.target))
94-
openapi_params["tags"] = OpenAPI.Servers.to_param(Vector{String}, query_params, "tags", required=true, )
94+
openapi_params["tags"] = OpenAPI.Servers.to_param(Vector{String}, query_params, "tags", required=true, style="form", is_explode=false)
9595
req.context[:openapi_params] = openapi_params
9696

9797
return handler(req)

samples/server/petstore/julia/src/apis/api_UserApi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ function login_user_read(handler)
143143
function login_user_read_handler(req::HTTP.Request)
144144
openapi_params = Dict{String,Any}()
145145
query_params = HTTP.queryparams(URIs.URI(req.target))
146-
openapi_params["username"] = OpenAPI.Servers.to_param(String, query_params, "username", required=true, )
147-
openapi_params["password"] = OpenAPI.Servers.to_param(String, query_params, "password", required=true, )
146+
openapi_params["username"] = OpenAPI.Servers.to_param(String, query_params, "username", required=true, style="form", is_explode=true)
147+
openapi_params["password"] = OpenAPI.Servers.to_param(String, query_params, "password", required=true, style="form", is_explode=true)
148148
req.context[:openapi_params] = openapi_params
149149

150150
return handler(req)

0 commit comments

Comments
 (0)