Skip to content

Commit

Permalink
generate_unbound_methods expose in the rule (#1793)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoido authored Nov 5, 2020
1 parent 5c12567 commit 3408ed9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion protoc-gen-openapiv2/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def _run_proto_gen_openapi(
grpc_api_configuration,
single_output,
json_names_for_fields,
fqn_for_openapi_name):
fqn_for_openapi_name,
generate_unbound_methods):
args = actions.args()

args.add("--plugin", "protoc-gen-openapiv2=%s" % protoc_gen_openapiv2.path)
Expand All @@ -73,6 +74,9 @@ def _run_proto_gen_openapi(
if fqn_for_openapi_name:
args.add("--openapi_opt", "fqn_for_openapi_name=true")

if generate_unbound_methods:
args.add("--openapiv2_opt", "generate_unbound_methods=true")

proto_file_infos = _direct_source_infos(proto_info)

# TODO(yannic): Use |proto_info.transitive_descriptor_sets| when
Expand Down Expand Up @@ -158,6 +162,7 @@ def _proto_gen_openapi_impl(ctx):
single_output = ctx.attr.single_output,
json_names_for_fields = ctx.attr.json_names_for_fields,
fqn_for_openapi_name = ctx.attr.fqn_for_openapi_name,
generate_unbound_methods = ctx.attr.generate_unbound_methods,
),
),
),
Expand Down Expand Up @@ -185,6 +190,10 @@ protoc_gen_openapiv2 = rule(
default = False,
mandatory = False,
),
"generate_unbound_methods": attr.bool(
default = False,
mandatory = False,
),
"_protoc": attr.label(
default = "@com_google_protobuf//:protoc",
executable = True,
Expand Down

0 comments on commit 3408ed9

Please sign in to comment.