diff --git a/.github/workflows/samples-julia.yaml b/.github/workflows/samples-julia.yaml index 622a87da43a..bf3d209ad03 100644 --- a/.github/workflows/samples-julia.yaml +++ b/.github/workflows/samples-julia.yaml @@ -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\");" diff --git a/bin/configs/julia-client-petstore-new.yaml b/bin/configs/julia-client-petstore-new.yaml index ff009f02d7c..a08bf6c2b5c 100644 --- a/bin/configs/julia-client-petstore-new.yaml +++ b/bin/configs/julia-client-petstore-new.yaml @@ -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" \ No newline at end of file diff --git a/bin/configs/julia-server-petstore-new.yaml b/bin/configs/julia-server-petstore-new.yaml index cabad7fdb9c..26159cdbda5 100644 --- a/bin/configs/julia-server-petstore-new.yaml +++ b/bin/configs/julia-server-petstore-new.yaml @@ -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" \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/julia-server/api.mustache b/modules/openapi-generator/src/main/resources/julia-server/api.mustache index 4f3a3f786cc..8d98de8e7f2 100644 --- a/modules/openapi-generator/src/main/resources/julia-server/api.mustache +++ b/modules/openapi-generator/src/main/resources/julia-server/api.mustache @@ -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) diff --git a/samples/client/petstore/julia/.openapi-generator/FILES b/samples/client/petstore/julia/.openapi-generator/FILES index b9cea9e6f64..0a37d594a75 100644 --- a/samples/client/petstore/julia/.openapi-generator/FILES +++ b/samples/client/petstore/julia/.openapi-generator/FILES @@ -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 diff --git a/samples/client/petstore/julia/README.md b/samples/client/petstore/julia/README.md index f596feac9b8..18eee25f894 100644 --- a/samples/client/petstore/julia/README.md +++ b/samples/client/petstore/julia/README.md @@ -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. diff --git a/samples/client/petstore/julia/src/PetStoreClient.jl b/samples/client/petstore/julia/src/OpenAPIGenPetStoreClient.jl similarity index 88% rename from samples/client/petstore/julia/src/PetStoreClient.jl rename to samples/client/petstore/julia/src/OpenAPIGenPetStoreClient.jl index e90d860dfe4..b4effe42bb3 100644 --- a/samples/client/petstore/julia/src/PetStoreClient.jl +++ b/samples/client/petstore/julia/src/OpenAPIGenPetStoreClient.jl @@ -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 diff --git a/samples/server/petstore/julia/.openapi-generator/FILES b/samples/server/petstore/julia/.openapi-generator/FILES index d9189bb54e3..21bc78ee8e9 100644 --- a/samples/server/petstore/julia/.openapi-generator/FILES +++ b/samples/server/petstore/julia/.openapi-generator/FILES @@ -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 diff --git a/samples/server/petstore/julia/README.md b/samples/server/petstore/julia/README.md index e44f99e9b8c..37e15b34730 100644 --- a/samples/server/petstore/julia/README.md +++ b/samples/server/petstore/julia/README.md @@ -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( diff --git a/samples/server/petstore/julia/src/PetStoreServer.jl b/samples/server/petstore/julia/src/OpenAPIGenPetStoreServer.jl similarity index 97% rename from samples/server/petstore/julia/src/PetStoreServer.jl rename to samples/server/petstore/julia/src/OpenAPIGenPetStoreServer.jl index a1b8a0a6970..b8569ebccfe 100644 --- a/samples/server/petstore/julia/src/PetStoreServer.jl +++ b/samples/server/petstore/julia/src/OpenAPIGenPetStoreServer.jl @@ -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