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: julia-actions/setup-julia@v1
|
||||
with:
|
||||
version: 1
|
||||
version: 1.8
|
||||
arch: x64
|
||||
- name: Test
|
||||
shell: bash
|
||||
@ -30,12 +30,12 @@ jobs:
|
||||
# Using develop mode to install package so that it is easier to modify the package test files
|
||||
julia -e "using Pkg; Pkg.develop(\"OpenAPI\");"
|
||||
cd ~/.julia/dev/OpenAPI
|
||||
git checkout v0.1.12
|
||||
git checkout v0.1.14
|
||||
cd $currdir
|
||||
rm -rf ~/.julia/dev/OpenAPI/test/client/petstore_v3/petstore
|
||||
rm -rf ~/.julia/dev/OpenAPI/test/server/petstore_v3/petstore
|
||||
cp -r client/petstore/julia ~/.julia/dev/OpenAPI/test/client/petstore_v3/petstore
|
||||
cp -r server/petstore/julia ~/.julia/dev/OpenAPI/test/server/petstore_v3/petstore
|
||||
rm -rf ~/.julia/dev/OpenAPI/test/client/openapigenerator_petstore_v3/petstore
|
||||
rm -rf ~/.julia/dev/OpenAPI/test/server/openapigenerator_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/openapigenerator_petstore_v3/petstore
|
||||
# setting this env runs only the tests relevant to the openapi-generator repo
|
||||
export OPENAPI_GENERATOR=true
|
||||
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
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
packageName: PetStoreClient
|
||||
packageName: OpenAPIGenPetStoreClient
|
||||
exportOperations: "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
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
packageName: PetStoreServer
|
||||
packageName: OpenAPIGenPetStoreServer
|
||||
exportOperations: "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}}
|
||||
ismultipart = {{#isMultipart}}true{{/isMultipart}}{{^isMultipart}}false{{/isMultipart}}
|
||||
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
|
||||
|
||||
return handler(req)
|
||||
|
@ -8,7 +8,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
src/PetStoreClient.jl
|
||||
src/OpenAPIGenPetStoreClient.jl
|
||||
src/apis/api_PetApi.jl
|
||||
src/apis/api_StoreApi.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.
|
||||
|
||||
@ -10,8 +10,8 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
|
||||
|
||||
|
||||
## Installation
|
||||
Place the Julia files generated under the `src` folder in your Julia project. Include PetStoreClient.jl in the project code.
|
||||
It would include the module named PetStoreClient.
|
||||
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 OpenAPIGenPetStoreClient.
|
||||
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file was generated by the Julia OpenAPI Code Generator
|
||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||
|
||||
module PetStoreClient
|
||||
module OpenAPIGenPetStoreClient
|
||||
|
||||
using Dates, TimeZones
|
||||
using OpenAPI
|
||||
@ -28,4 +28,4 @@ export PetApi
|
||||
export StoreApi
|
||||
export UserApi
|
||||
|
||||
end # module PetStoreClient
|
||||
end # module OpenAPIGenPetStoreClient
|
@ -8,7 +8,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
src/PetStoreServer.jl
|
||||
src/OpenAPIGenPetStoreServer.jl
|
||||
src/apis/api_PetApi.jl
|
||||
src/apis/api_StoreApi.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.
|
||||
|
||||
@ -10,11 +10,11 @@ This API server was generated by the [OpenAPI Generator](https://openapi-generat
|
||||
|
||||
|
||||
## Installation
|
||||
Place the Julia files generated under the `src` folder in your Julia project. Include PetStoreServer.jl in the project code.
|
||||
It would include the module named PetStoreServer.
|
||||
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 OpenAPIGenPetStoreServer.
|
||||
|
||||
Implement the server methods as listed below. They are also documented with the PetStoreServer module.
|
||||
Launch a HTTP server with a router that has all handlers registered. A `register` method is provided in PetStoreServer module for convenience.
|
||||
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 OpenAPIGenPetStoreServer module for convenience.
|
||||
|
||||
```julia
|
||||
register(
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
@doc raw"""
|
||||
Encapsulates generated server code for PetStoreServer
|
||||
Encapsulates generated server code for OpenAPIGenPetStoreServer
|
||||
|
||||
The following server methods must be implemented:
|
||||
|
||||
@ -68,7 +68,7 @@ The following server methods must be implemented:
|
||||
- *invocation:* PUT /user/{username}
|
||||
- *signature:* update_user(req::HTTP.Request, username::String, user::User;) -> Nothing
|
||||
"""
|
||||
module PetStoreServer
|
||||
module OpenAPIGenPetStoreServer
|
||||
|
||||
using HTTP
|
||||
using URIs
|
||||
@ -120,4 +120,4 @@ export Pet
|
||||
export Tag
|
||||
export User
|
||||
|
||||
end # module PetStoreServer
|
||||
end # module OpenAPIGenPetStoreServer
|
Loading…
x
Reference in New Issue
Block a user