forked from loafle/openapi-generator-original
[Julia] update samples test and a minor fix (#16152)
* [Julia] update samples test and a minor fix - updating samples test for Julia generated code to use the latest OpenAPI.jl Julia package, which includes tests for file uploads - also including a fix where generated code duplicated the `mandatory` flag in one of the method calls * add blank line, trigger build with julia workflow * more updates to julia samples tests * add samples changes
This commit is contained in:
parent
f590ef1bcf
commit
c71b48fe1a
12
.github/workflows/samples-julia.yaml
vendored
12
.github/workflows/samples-julia.yaml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: julia-actions/setup-julia@v1
|
- uses: julia-actions/setup-julia@v1
|
||||||
with:
|
with:
|
||||||
version: 1
|
version: 1.8
|
||||||
arch: x64
|
arch: x64
|
||||||
- name: Test
|
- name: Test
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -30,12 +30,12 @@ jobs:
|
|||||||
# Using develop mode to install package so that it is easier to modify the package test files
|
# Using develop mode to install package so that it is easier to modify the package test files
|
||||||
julia -e "using Pkg; Pkg.develop(\"OpenAPI\");"
|
julia -e "using Pkg; Pkg.develop(\"OpenAPI\");"
|
||||||
cd ~/.julia/dev/OpenAPI
|
cd ~/.julia/dev/OpenAPI
|
||||||
git checkout v0.1.12
|
git checkout v0.1.14
|
||||||
cd $currdir
|
cd $currdir
|
||||||
rm -rf ~/.julia/dev/OpenAPI/test/client/petstore_v3/petstore
|
rm -rf ~/.julia/dev/OpenAPI/test/client/openapigenerator_petstore_v3/petstore
|
||||||
rm -rf ~/.julia/dev/OpenAPI/test/server/petstore_v3/petstore
|
rm -rf ~/.julia/dev/OpenAPI/test/server/openapigenerator_petstore_v3/petstore
|
||||||
cp -r client/petstore/julia ~/.julia/dev/OpenAPI/test/client/petstore_v3/petstore
|
cp -r client/petstore/julia ~/.julia/dev/OpenAPI/test/client/openapigenerator_petstore_v3/petstore
|
||||||
cp -r server/petstore/julia ~/.julia/dev/OpenAPI/test/server/petstore_v3/petstore
|
cp -r server/petstore/julia ~/.julia/dev/OpenAPI/test/server/openapigenerator_petstore_v3/petstore
|
||||||
# setting this env runs only the tests relevant to the openapi-generator repo
|
# setting this env runs only the tests relevant to the openapi-generator repo
|
||||||
export OPENAPI_GENERATOR=true
|
export OPENAPI_GENERATOR=true
|
||||||
julia -e "using Pkg; Pkg.test(\"OpenAPI\");"
|
julia -e "using Pkg; Pkg.test(\"OpenAPI\");"
|
||||||
|
@ -4,6 +4,6 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
|||||||
templateDir: modules/openapi-generator/src/main/resources/julia-client
|
templateDir: modules/openapi-generator/src/main/resources/julia-client
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
packageName: PetStoreClient
|
packageName: OpenAPIGenPetStoreClient
|
||||||
exportOperations: "true"
|
exportOperations: "true"
|
||||||
exportModels: "true"
|
exportModels: "true"
|
@ -4,6 +4,6 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
|||||||
templateDir: modules/openapi-generator/src/main/resources/julia-server
|
templateDir: modules/openapi-generator/src/main/resources/julia-server
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
packageName: PetStoreServer
|
packageName: OpenAPIGenPetStoreServer
|
||||||
exportOperations: "true"
|
exportOperations: "true"
|
||||||
exportModels: "true"
|
exportModels: "true"
|
@ -14,7 +14,7 @@ function {{operationId}}_read(handler)
|
|||||||
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param_type({{dataType}}, String(req.body)){{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}
|
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param_type({{dataType}}, String(req.body)){{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}
|
||||||
ismultipart = {{#isMultipart}}true{{/isMultipart}}{{^isMultipart}}false{{/isMultipart}}
|
ismultipart = {{#isMultipart}}true{{/isMultipart}}{{^isMultipart}}false{{/isMultipart}}
|
||||||
form_data = ismultipart ? HTTP.parse_multipart_form(req) : HTTP.queryparams(String(copy(req.body))){{#formParams}}
|
form_data = ismultipart ? HTTP.parse_multipart_form(req) : HTTP.queryparams(String(copy(req.body))){{#formParams}}
|
||||||
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param({{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}, form_data, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"; {{#required}}required=true, {{/required}}multipart=ismultipart, isfile={{#isFile}}true{{/isFile}}{{^isFile}}false{{/isFile}}, {{#required}}required=true, {{/required}}{{#isListContainer}}collection_format="{{collectionFormat}}", {{/isListContainer}}){{/formParams}}{{/hasFormParams}}
|
openapi_params["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = OpenAPI.Servers.to_param({{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}, form_data, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"; multipart=ismultipart, isfile={{#isFile}}true{{/isFile}}{{^isFile}}false{{/isFile}}, {{#required}}required=true, {{/required}}{{#isListContainer}}collection_format="{{collectionFormat}}", {{/isListContainer}}){{/formParams}}{{/hasFormParams}}
|
||||||
req.context[:openapi_params] = openapi_params
|
req.context[:openapi_params] = openapi_params
|
||||||
|
|
||||||
return handler(req)
|
return handler(req)
|
||||||
|
@ -8,7 +8,7 @@ docs/StoreApi.md
|
|||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
docs/User.md
|
docs/User.md
|
||||||
docs/UserApi.md
|
docs/UserApi.md
|
||||||
src/PetStoreClient.jl
|
src/OpenAPIGenPetStoreClient.jl
|
||||||
src/apis/api_PetApi.jl
|
src/apis/api_PetApi.jl
|
||||||
src/apis/api_StoreApi.jl
|
src/apis/api_StoreApi.jl
|
||||||
src/apis/api_UserApi.jl
|
src/apis/api_UserApi.jl
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Julia API client for PetStoreClient
|
# Julia API client for OpenAPIGenPetStoreClient
|
||||||
|
|
||||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
|
||||||
@ -10,8 +10,8 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
|
|||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Place the Julia files generated under the `src` folder in your Julia project. Include PetStoreClient.jl in the project code.
|
Place the Julia files generated under the `src` folder in your Julia project. Include OpenAPIGenPetStoreClient.jl in the project code.
|
||||||
It would include the module named PetStoreClient.
|
It would include the module named OpenAPIGenPetStoreClient.
|
||||||
|
|
||||||
Documentation is generated as markdown files under the `docs` folder. You can include them in your project documentation.
|
Documentation is generated as markdown files under the `docs` folder. You can include them in your project documentation.
|
||||||
Documentation is also embedded in Julia which can be used with a Julia specific documentation generator.
|
Documentation is also embedded in Julia which can be used with a Julia specific documentation generator.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# This file was generated by the Julia OpenAPI Code Generator
|
# This file was generated by the Julia OpenAPI Code Generator
|
||||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||||
|
|
||||||
module PetStoreClient
|
module OpenAPIGenPetStoreClient
|
||||||
|
|
||||||
using Dates, TimeZones
|
using Dates, TimeZones
|
||||||
using OpenAPI
|
using OpenAPI
|
||||||
@ -28,4 +28,4 @@ export PetApi
|
|||||||
export StoreApi
|
export StoreApi
|
||||||
export UserApi
|
export UserApi
|
||||||
|
|
||||||
end # module PetStoreClient
|
end # module OpenAPIGenPetStoreClient
|
@ -8,7 +8,7 @@ docs/StoreApi.md
|
|||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
docs/User.md
|
docs/User.md
|
||||||
docs/UserApi.md
|
docs/UserApi.md
|
||||||
src/PetStoreServer.jl
|
src/OpenAPIGenPetStoreServer.jl
|
||||||
src/apis/api_PetApi.jl
|
src/apis/api_PetApi.jl
|
||||||
src/apis/api_StoreApi.jl
|
src/apis/api_StoreApi.jl
|
||||||
src/apis/api_UserApi.jl
|
src/apis/api_UserApi.jl
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Julia API server for PetStoreServer
|
# Julia API server for OpenAPIGenPetStoreServer
|
||||||
|
|
||||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
|
||||||
@ -10,11 +10,11 @@ This API server was generated by the [OpenAPI Generator](https://openapi-generat
|
|||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Place the Julia files generated under the `src` folder in your Julia project. Include PetStoreServer.jl in the project code.
|
Place the Julia files generated under the `src` folder in your Julia project. Include OpenAPIGenPetStoreServer.jl in the project code.
|
||||||
It would include the module named PetStoreServer.
|
It would include the module named OpenAPIGenPetStoreServer.
|
||||||
|
|
||||||
Implement the server methods as listed below. They are also documented with the PetStoreServer module.
|
Implement the server methods as listed below. They are also documented with the OpenAPIGenPetStoreServer module.
|
||||||
Launch a HTTP server with a router that has all handlers registered. A `register` method is provided in PetStoreServer module for convenience.
|
Launch a HTTP server with a router that has all handlers registered. A `register` method is provided in OpenAPIGenPetStoreServer module for convenience.
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
register(
|
register(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
@doc raw"""
|
@doc raw"""
|
||||||
Encapsulates generated server code for PetStoreServer
|
Encapsulates generated server code for OpenAPIGenPetStoreServer
|
||||||
|
|
||||||
The following server methods must be implemented:
|
The following server methods must be implemented:
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ The following server methods must be implemented:
|
|||||||
- *invocation:* PUT /user/{username}
|
- *invocation:* PUT /user/{username}
|
||||||
- *signature:* update_user(req::HTTP.Request, username::String, user::User;) -> Nothing
|
- *signature:* update_user(req::HTTP.Request, username::String, user::User;) -> Nothing
|
||||||
"""
|
"""
|
||||||
module PetStoreServer
|
module OpenAPIGenPetStoreServer
|
||||||
|
|
||||||
using HTTP
|
using HTTP
|
||||||
using URIs
|
using URIs
|
||||||
@ -120,4 +120,4 @@ export Pet
|
|||||||
export Tag
|
export Tag
|
||||||
export User
|
export User
|
||||||
|
|
||||||
end # module PetStoreServer
|
end # module OpenAPIGenPetStoreServer
|
Loading…
x
Reference in New Issue
Block a user