chenrui333 / rules_openapi

🍃 bazel rules for generating code from openapi specifications
MIT License
53 stars 25 forks source link

openapi generator v7.4.0 #62

Open loeffel-io opened 8 months ago

loeffel-io commented 8 months ago

Hello, in order to use v7.4.0 from https://github.com/OpenAPITools/openapi-generator it was necessary for me to run the tool (in the ci pipeline) with another java toolchain:

container_pull(
    name = "bazel",
    digest = "sha256:3348b14c7b45a4fbf06fee34996a8d15da72f43bb282a81f4720a0c0a5c37dca",  # https://console.cloud.google.com/gcr/images/bazel-public/global/bazel
    registry = "gcr.io",
    repository = "bazel-public/bazel",
)
diff --git openapi/openapi.bzl openapi/openapi.bzl
index 76f4467..8296635 100644
--- openapi/openapi.bzl
+++ openapi/openapi.bzl
@@ -141,7 +141,7 @@ def _new_generator_command(ctx, gen_dir, rjars):

     # fixme: by default, swagger-codegen is rather verbose. this helps with that but can also mask useful error messages
     # when it fails. look into log configuration options. it's a java app so perhaps just a log4j.properties or something
-    gen_cmd += " 2>/dev/null"
+    #gen_cmd += " 2>/dev/null"
     return gen_cmd

 def _impl(ctx):
@@ -243,7 +243,7 @@ openapi_gen = rule(
         "type_mappings": attr.string_dict(),
         "import_mappings": attr.string(),
         "_jdk": attr.label(
-            default = Label("@bazel_tools//tools/jdk:current_java_runtime"),
+            default = Label("@bazel_tools//tools/jdk:remote_jdk11"),
             providers = [java_common.JavaRuntimeInfo],
         ),
         "codegen_cli": attr.label(

would you be open to make the _jdk arg public? ref: https://github.com/meetup/rules_openapi/blob/master/openapi/openapi.bzl#L245

openapi generator v7.4.0 rules_openapi e42769a98fef5634bee0f921e4b90786a6b3292aa11fe8d2f84c045ac435ab29 bazel 7.1.0

chenrui333 commented 3 months ago

@loeffel-io feel free to drop a PR, thanks!!