diff --git a/.github/workflows/samples-julia.yaml b/.github/workflows/samples-julia.yaml index 4463a2f45c65..72c402781ee9 100644 --- a/.github/workflows/samples-julia.yaml +++ b/.github/workflows/samples-julia.yaml @@ -24,19 +24,26 @@ jobs: shell: bash working-directory: 'samples' run: | - currdir=`pwd` + currdir=$(pwd) # The julia-client/julia-server generators target the OpenAPI.jl 0.2.x series, # maintained on the release-0.2 branch; OpenAPI.jl main hosts the 1.x rewrite # with a different API. Testing against release-0.2 covers the latest 0.2.x fixes. + # Clone the exact branch we want instead of resolving from the registry, which can + # pick up stale or mismatched package metadata. + rm -rf ~/.julia/dev/OpenAPI + git clone --branch release-0.2 --depth 1 https://github.com/JuliaComputing/OpenAPI.jl.git ~/.julia/dev/OpenAPI + # 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(path=joinpath(homedir(), ".julia", "dev", "OpenAPI")); Pkg.instantiate()' + cd ~/.julia/dev/OpenAPI - git checkout release-0.2 - cd $currdir + cd "$currdir" + 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\");" + julia -e 'using Pkg; Pkg.test("OpenAPI")' diff --git a/modules/openapi-generator/src/test/resources/3_0/julia/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/julia/petstore.yaml index 826074f7a374..8c61f35455c2 100644 --- a/modules/openapi-generator/src/test/resources/3_0/julia/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/julia/petstore.yaml @@ -452,6 +452,7 @@ paths: required: true schema: type: string + format: password responses: '200': description: successful operation @@ -687,6 +688,7 @@ components: type: string password: type: string + format: password phone: type: string userStatus: diff --git a/samples/client/petstore/julia/src/models/model_User.jl b/samples/client/petstore/julia/src/models/model_User.jl index 8e95c9ac67b9..e3ef1b158495 100644 --- a/samples/client/petstore/julia/src/models/model_User.jl +++ b/samples/client/petstore/julia/src/models/model_User.jl @@ -70,6 +70,9 @@ function OpenAPI.validate_property(::Type{ User }, name::Symbol, val) + if name === Symbol("password") + OpenAPI.validate_param(name, "User", :format, val, "password") + end if name === Symbol("userStatus") diff --git a/samples/server/petstore/julia/src/models/model_User.jl b/samples/server/petstore/julia/src/models/model_User.jl index 8e95c9ac67b9..e3ef1b158495 100644 --- a/samples/server/petstore/julia/src/models/model_User.jl +++ b/samples/server/petstore/julia/src/models/model_User.jl @@ -70,6 +70,9 @@ function OpenAPI.validate_property(::Type{ User }, name::Symbol, val) + if name === Symbol("password") + OpenAPI.validate_param(name, "User", :format, val, "password") + end if name === Symbol("userStatus")