From d93e98140fd04347fda6d8c1410384d35902a4d7 Mon Sep 17 00:00:00 2001 From: Tanmay Mohapatra Date: Thu, 27 Aug 2026 12:26:34 +0530 Subject: [PATCH 1/2] [julia] Emit Project.toml, track OpenAPI.jl release-0.2, fix exportOperations - Emit a Project.toml with generated clients and servers, pinning OpenAPI = "0.2" so fresh environments do not resolve to the incompatible OpenAPI.jl 1.x. The package UUID is derived deterministically from the package name for reproducible generation. - Point samples-julia.yaml at the release-0.2 maintenance branch of OpenAPI.jl instead of the v0.2.0 tag so samples are tested against the latest 0.2.x fixes. - Fix the exportOperations option in JuliaClientCodegen writing through the exportModels setter and value. - Document the OpenAPI.jl 0.2.x runtime compatibility boundary in generated READMEs. - Remove stale docs/generators/julia.md; the registered generators are julia-client and julia-server, which have their own docs. --- .github/workflows/samples-julia.yaml | 7 +- docs/generators/julia.md | 213 ------------------ .../codegen/languages/JuliaClientCodegen.java | 8 +- .../codegen/languages/JuliaServerCodegen.java | 4 + .../resources/julia-client/Project.mustache | 13 ++ .../resources/julia-client/README.mustache | 5 +- .../resources/julia-server/Project.mustache | 17 ++ .../resources/julia-server/README.mustache | 5 +- .../petstore/julia/.openapi-generator/FILES | 1 + samples/client/petstore/julia/Project.toml | 15 ++ samples/client/petstore/julia/README.md | 5 +- .../petstore/julia/.openapi-generator/FILES | 1 + samples/server/petstore/julia/Project.toml | 19 ++ samples/server/petstore/julia/README.md | 5 +- 14 files changed, 96 insertions(+), 222 deletions(-) delete mode 100644 docs/generators/julia.md create mode 100644 modules/openapi-generator/src/main/resources/julia-client/Project.mustache create mode 100644 modules/openapi-generator/src/main/resources/julia-server/Project.mustache create mode 100644 samples/client/petstore/julia/Project.toml create mode 100644 samples/server/petstore/julia/Project.toml diff --git a/.github/workflows/samples-julia.yaml b/.github/workflows/samples-julia.yaml index f4612803f31b..4463a2f45c65 100644 --- a/.github/workflows/samples-julia.yaml +++ b/.github/workflows/samples-julia.yaml @@ -25,12 +25,13 @@ jobs: working-directory: 'samples' run: | currdir=`pwd` - # Using a specific version of OpenAPI.jl helps avoid introducing version inter-dependencies - # and allows breaking changes to be done in either repos independently + # 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. # 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.2.0 + git checkout release-0.2 cd $currdir rm -rf ~/.julia/dev/OpenAPI/test/client/openapigenerator_petstore_v3/petstore rm -rf ~/.julia/dev/OpenAPI/test/server/openapigenerator_petstore_v3/petstore diff --git a/docs/generators/julia.md b/docs/generators/julia.md deleted file mode 100644 index 7d3ad4d660b8..000000000000 --- a/docs/generators/julia.md +++ /dev/null @@ -1,213 +0,0 @@ ---- -title: Documentation for the julia Generator ---- - -## METADATA - -| Property | Value | Notes | -| -------- | ----- | ----- | -| generator name | julia | pass this to the generate command after -g | -| generator stability | STABLE | | -| generator type | CLIENT | | -| generator language | Java | | -| generator default templating engine | mustache | | -| helpTxt | Generates a julia client. | | - -## CONFIG OPTIONS -These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. - -| Option | Description | Values | Default | -| ------ | ----------- | ------ | ------- | -|packageName|Julia package name.| |APIClient| - -## IMPORT MAPPING - -| Type/Alias | Imports | -| ---------- | ------- | - - -## INSTANTIATION TYPES - -| Type/Alias | Instantiated By | -| ---------- | --------------- | - - -## LANGUAGE PRIMITIVES - - - -## RESERVED WORDS - - - -## FEATURE SET - - -### Client Modification Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasePath|✗|ToolingExtension -|Authorizations|✗|ToolingExtension -|UserAgent|✗|ToolingExtension -|MockServer|✗|ToolingExtension - -### Data Type Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Custom|✗|OAS2,OAS3 -|Int32|✓|OAS2,OAS3 -|Int64|✓|OAS2,OAS3 -|Float|✓|OAS2,OAS3 -|Double|✓|OAS2,OAS3 -|Decimal|✓|ToolingExtension -|String|✓|OAS2,OAS3 -|Byte|✓|OAS2,OAS3 -|Binary|✓|OAS2,OAS3 -|Boolean|✓|OAS2,OAS3 -|Date|✓|OAS2,OAS3 -|DateTime|✓|OAS2,OAS3 -|Password|✓|OAS2,OAS3 -|File|✓|OAS2 -|Uuid|✗| -|Array|✓|OAS2,OAS3 -|Null|✗|OAS3 -|AnyType|✗|OAS2,OAS3 -|Object|✓|OAS2,OAS3 -|Maps|✓|ToolingExtension -|CollectionFormat|✓|OAS2 -|CollectionFormatMulti|✓|OAS2 -|Enum|✓|OAS2,OAS3 -|ArrayOfEnum|✓|ToolingExtension -|ArrayOfModel|✓|ToolingExtension -|ArrayOfCollectionOfPrimitives|✓|ToolingExtension -|ArrayOfCollectionOfModel|✓|ToolingExtension -|ArrayOfCollectionOfEnum|✓|ToolingExtension -|MapOfEnum|✓|ToolingExtension -|MapOfModel|✓|ToolingExtension -|MapOfCollectionOfPrimitives|✓|ToolingExtension -|MapOfCollectionOfModel|✓|ToolingExtension -|MapOfCollectionOfEnum|✓|ToolingExtension - -### Documentation Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Readme|✗|ToolingExtension -|Model|✓|ToolingExtension -|Api|✓|ToolingExtension - -### Global Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Host|✓|OAS2,OAS3 -|BasePath|✓|OAS2,OAS3 -|Info|✓|OAS2,OAS3 -|Schemes|✗|OAS2,OAS3 -|PartialSchemes|✓|OAS2,OAS3 -|Consumes|✓|OAS2 -|Produces|✓|OAS2 -|ExternalDocumentation|✓|OAS2,OAS3 -|Examples|✓|OAS2,OAS3 -|XMLStructureDefinitions|✗|OAS2,OAS3 -|MultiServer|✗|OAS3 -|ParameterizedServer|✗|OAS3 -|ParameterStyling|✗|OAS3 -|Callbacks|✓|OAS3 -|LinkObjects|✗|OAS3 - -### Parameter Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Path|✓|OAS2,OAS3 -|Query|✓|OAS2,OAS3 -|Header|✓|OAS2,OAS3 -|Body|✓|OAS2 -|FormUnencoded|✓|OAS2 -|FormMultipart|✓|OAS2 -|Cookie|✓|OAS3 - -### Schema Support Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Simple|✓|OAS2,OAS3 -|Composite|✓|OAS2,OAS3 -|Polymorphism|✓|OAS2,OAS3 -|Union|✗|OAS3 -|allOf|✗|OAS2,OAS3 -|anyOf|✗|OAS3 -|oneOf|✗|OAS3 -|not|✗|OAS3 - -### Security Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasicAuth|✓|OAS2,OAS3 -|ApiKey|✓|OAS2,OAS3 -|OpenIDConnect|✗|OAS3 -|BearerToken|✓|OAS3 -|OAuth2_Implicit|✓|OAS2,OAS3 -|OAuth2_Password|✓|OAS2,OAS3 -|OAuth2_ClientCredentials|✓|OAS2,OAS3 -|OAuth2_AuthorizationCode|✓|OAS2,OAS3 -|SignatureAuth|✗|OAS3 - -### Wire Format Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|JSON|✓|OAS2,OAS3 -|XML|✓|OAS2,OAS3 -|PROTOBUF|✗|ToolingExtension -|Custom|✗|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaClientCodegen.java index de5887cd3de0..9c4840da989c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaClientCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.meta.Stability; import java.io.File; +import java.nio.charset.StandardCharsets; +import java.util.UUID; /** *

Mustache templates are located in {@code src/main/resources/julia-client/}. @@ -103,12 +105,14 @@ public void processOpts() { additionalProperties.put("exportModels", exportModels); if (additionalProperties.containsKey("exportOperations")) { - setExportModels(Boolean.parseBoolean((String) additionalProperties.get("exportOperations"))); + setExportOperations(Boolean.parseBoolean((String) additionalProperties.get("exportOperations"))); } - additionalProperties.put("exportOperations", exportModels); + additionalProperties.put("exportOperations", exportOperations); + additionalProperties.put("packageUUID", UUID.nameUUIDFromBytes(("openapi-generator-julia-client-" + packageName).getBytes(StandardCharsets.UTF_8)).toString()); additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); + supportingFiles.add(new SupportingFile("Project.mustache", "", "Project.toml")); supportingFiles.add(new SupportingFile("client.mustache", srcPath, packageName + ".jl")); supportingFiles.add(new SupportingFile("modelincludes.mustache", srcPath, "modelincludes.jl")); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaServerCodegen.java index 6acd686ff2c7..6c5a4dc43975 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JuliaServerCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.meta.Stability; import java.io.File; +import java.nio.charset.StandardCharsets; +import java.util.UUID; /** *

Mustache templates are located in {@code src/main/resources/julia-server/}. @@ -99,8 +101,10 @@ public void processOpts() { } additionalProperties.put("exportModels", exportModels); + additionalProperties.put("packageUUID", UUID.nameUUIDFromBytes(("openapi-generator-julia-server-" + packageName).getBytes(StandardCharsets.UTF_8)).toString()); additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); + supportingFiles.add(new SupportingFile("Project.mustache", "", "Project.toml")); supportingFiles.add(new SupportingFile("server.mustache", srcPath, packageName + ".jl")); supportingFiles.add(new SupportingFile("modelincludes.mustache", srcPath, "modelincludes.jl")); } diff --git a/modules/openapi-generator/src/main/resources/julia-client/Project.mustache b/modules/openapi-generator/src/main/resources/julia-client/Project.mustache new file mode 100644 index 000000000000..ef8b0a6e083f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/julia-client/Project.mustache @@ -0,0 +1,13 @@ +{{>partial_header}} +name = "{{packageName}}" +uuid = "{{packageUUID}}" + +[deps] +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +OpenAPI = "d5e62ea6-ddf3-4d43-8e4c-ad5e6c8bfd7d" +TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" + +[compat] +OpenAPI = "0.2" +TimeZones = "1" +julia = "1.6" diff --git a/modules/openapi-generator/src/main/resources/julia-client/README.mustache b/modules/openapi-generator/src/main/resources/julia-client/README.mustache index 12910037f830..350aedb7d66e 100644 --- a/modules/openapi-generator/src/main/resources/julia-client/README.mustache +++ b/modules/openapi-generator/src/main/resources/julia-client/README.mustache @@ -18,9 +18,12 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} +## Runtime compatibility +This generator targets the 0.2.x series of [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl), and the generated `Project.toml` pins `OpenAPI = "0.2"` accordingly. OpenAPI.jl 1.x is a pure-Julia generator with a different API (`OpenAPI.client`); code produced by this generator does not run on it. Julia-native users who do not need this generator's features may prefer generating directly with OpenAPI.jl 1.x. + ## Installation Place the Julia files generated under the `src` folder in your Julia project. Include {{packageName}}.jl in the project code. -It would include the module named {{packageName}}. +It would include the module named {{packageName}}. The generated `Project.toml` declares the required dependencies and compatible versions; use it as the project environment or merge its entries into your own project. 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/modules/openapi-generator/src/main/resources/julia-server/Project.mustache b/modules/openapi-generator/src/main/resources/julia-server/Project.mustache new file mode 100644 index 000000000000..5434d090bfdc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/julia-server/Project.mustache @@ -0,0 +1,17 @@ +{{>partial_header}} +name = "{{packageName}}" +uuid = "{{packageUUID}}" + +[deps] +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" +OpenAPI = "d5e62ea6-ddf3-4d43-8e4c-ad5e6c8bfd7d" +TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" +URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" + +[compat] +HTTP = "1" +OpenAPI = "0.2" +TimeZones = "1" +URIs = "1" +julia = "1.6" diff --git a/modules/openapi-generator/src/main/resources/julia-server/README.mustache b/modules/openapi-generator/src/main/resources/julia-server/README.mustache index cf657260e0b2..4d7408c47256 100644 --- a/modules/openapi-generator/src/main/resources/julia-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/julia-server/README.mustache @@ -18,9 +18,12 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} +## Runtime compatibility +This generator targets the 0.2.x series of [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl), and the generated `Project.toml` pins `OpenAPI = "0.2"` accordingly. OpenAPI.jl 1.x is a pure-Julia generator with a different API (`OpenAPI.server`); code produced by this generator does not run on it. Julia-native users who do not need this generator's features may prefer generating directly with OpenAPI.jl 1.x. + ## Installation Place the Julia files generated under the `src` folder in your Julia project. Include {{packageName}}.jl in the project code. -It would include the module named {{packageName}}. +It would include the module named {{packageName}}. The generated `Project.toml` declares the required dependencies and compatible versions; use it as the project environment or merge its entries into your own project. Implement the server methods as listed below. They are also documented with the {{packageName}} module. Launch a HTTP server with a router that has all handlers registered. A `register` method is provided in {{packageName}} module for convenience. diff --git a/samples/client/petstore/julia/.openapi-generator/FILES b/samples/client/petstore/julia/.openapi-generator/FILES index 0fd28f028701..286f340a7962 100644 --- a/samples/client/petstore/julia/.openapi-generator/FILES +++ b/samples/client/petstore/julia/.openapi-generator/FILES @@ -1,3 +1,4 @@ +Project.toml README.md docs/ApiResponse.md docs/Category.md diff --git a/samples/client/petstore/julia/Project.toml b/samples/client/petstore/julia/Project.toml new file mode 100644 index 000000000000..c398bb9df8a4 --- /dev/null +++ b/samples/client/petstore/julia/Project.toml @@ -0,0 +1,15 @@ +# This file was generated by the Julia OpenAPI Code Generator +# Do not modify this file directly. Modify the OpenAPI specification instead. + +name = "OpenAPIGenPetStoreClient" +uuid = "c8baa31a-22f3-3e6f-80b2-d52e48f6776d" + +[deps] +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +OpenAPI = "d5e62ea6-ddf3-4d43-8e4c-ad5e6c8bfd7d" +TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" + +[compat] +OpenAPI = "0.2" +TimeZones = "1" +julia = "1.6" diff --git a/samples/client/petstore/julia/README.md b/samples/client/petstore/julia/README.md index ef2639b4b346..a745cfdbd6d2 100644 --- a/samples/client/petstore/julia/README.md +++ b/samples/client/petstore/julia/README.md @@ -10,9 +10,12 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - Build package: org.openapitools.codegen.languages.JuliaClientCodegen +## Runtime compatibility +This generator targets the 0.2.x series of [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl), and the generated `Project.toml` pins `OpenAPI = "0.2"` accordingly. OpenAPI.jl 1.x is a pure-Julia generator with a different API (`OpenAPI.client`); code produced by this generator does not run on it. Julia-native users who do not need this generator's features may prefer generating directly with OpenAPI.jl 1.x. + ## Installation 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. +It would include the module named OpenAPIGenPetStoreClient. The generated `Project.toml` declares the required dependencies and compatible versions; use it as the project environment or merge its entries into your own project. 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/server/petstore/julia/.openapi-generator/FILES b/samples/server/petstore/julia/.openapi-generator/FILES index c712606f5235..402c1e0effe5 100644 --- a/samples/server/petstore/julia/.openapi-generator/FILES +++ b/samples/server/petstore/julia/.openapi-generator/FILES @@ -1,3 +1,4 @@ +Project.toml README.md docs/AnotherModel.md docs/ApiResponse.md diff --git a/samples/server/petstore/julia/Project.toml b/samples/server/petstore/julia/Project.toml new file mode 100644 index 000000000000..ee62b4dd4d48 --- /dev/null +++ b/samples/server/petstore/julia/Project.toml @@ -0,0 +1,19 @@ +# This file was generated by the Julia OpenAPI Code Generator +# Do not modify this file directly. Modify the OpenAPI specification instead. + +name = "OpenAPIGenPetStoreServer" +uuid = "b5cb3ada-b255-3f07-be90-77727ad78427" + +[deps] +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" +OpenAPI = "d5e62ea6-ddf3-4d43-8e4c-ad5e6c8bfd7d" +TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" +URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" + +[compat] +HTTP = "1" +OpenAPI = "0.2" +TimeZones = "1" +URIs = "1" +julia = "1.6" diff --git a/samples/server/petstore/julia/README.md b/samples/server/petstore/julia/README.md index 7ee9f29652e4..4ac80d55647f 100644 --- a/samples/server/petstore/julia/README.md +++ b/samples/server/petstore/julia/README.md @@ -10,9 +10,12 @@ This API server was generated by the [OpenAPI Generator](https://openapi-generat - Build package: org.openapitools.codegen.languages.JuliaServerCodegen +## Runtime compatibility +This generator targets the 0.2.x series of [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl), and the generated `Project.toml` pins `OpenAPI = "0.2"` accordingly. OpenAPI.jl 1.x is a pure-Julia generator with a different API (`OpenAPI.server`); code produced by this generator does not run on it. Julia-native users who do not need this generator's features may prefer generating directly with OpenAPI.jl 1.x. + ## Installation 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. +It would include the module named OpenAPIGenPetStoreServer. The generated `Project.toml` declares the required dependencies and compatible versions; use it as the project environment or merge its entries into your own project. 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. From 68cef24be7acaa0614a06c8fd4ba1a5a8c66e638 Mon Sep 17 00:00:00 2001 From: Tanmay Mohapatra Date: Thu, 27 Aug 2026 12:57:53 +0530 Subject: [PATCH 2/2] retrigger CI (flaky remote-spec gradle test)