Skip to content

Commit 451590a

Browse files
Adds fqn_for_swagger_name to bazel defs (#1529)
1 parent 6c641e2 commit 451590a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

protoc-gen-openapiv2/defs.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def _run_proto_gen_openapi(
5353
protoc_gen_openapiv2,
5454
grpc_api_configuration,
5555
single_output,
56-
json_names_for_fields):
56+
json_names_for_fields,
57+
fqn_for_swagger_name):
5758
args = actions.args()
5859

5960
args.add("--plugin", "protoc-gen-openapiv2=%s" % protoc_gen_openapiv2.path)
@@ -69,6 +70,9 @@ def _run_proto_gen_openapi(
6970
if not json_names_for_fields:
7071
args.add("--openapiv2_opt", "json_names_for_fields=false")
7172

73+
if fqn_for_swagger_name:
74+
args.add("--swagger_opt", "fqn_for_swagger_name=true")
75+
7276
proto_file_infos = _direct_source_infos(proto_info)
7377

7478
# TODO(yannic): Use |proto_info.transitive_descriptor_sets| when
@@ -153,6 +157,7 @@ def _proto_gen_openapi_impl(ctx):
153157
grpc_api_configuration = ctx.file.grpc_api_configuration,
154158
single_output = ctx.attr.single_output,
155159
json_names_for_fields = ctx.attr.json_names_for_fields,
160+
fqn_for_swagger_name = ctx.attr.fqn_for_swagger_name,
156161
),
157162
),
158163
),
@@ -176,6 +181,10 @@ protoc_gen_openapiv2 = rule(
176181
default = True,
177182
mandatory = False,
178183
),
184+
"fqn_for_swagger_name": attr.bool(
185+
default = False,
186+
mandatory = False,
187+
),
179188
"_protoc": attr.label(
180189
default = "@com_google_protobuf//:protoc",
181190
executable = True,

0 commit comments

Comments
 (0)