Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposes generate_unbound_methods as protoc_gen_openapiv2 rule attr #1793

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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