Skip to content

Commit

Permalink
protoc-gen-swagger: update bazel rule
Browse files Browse the repository at this point in the history
json_names_for_fields defaults to true now
  • Loading branch information
johanbrandhorst committed May 25, 2020
1 parent cca518b commit 57089bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/_docs/v2-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ To change the swagger generator behaviour to match, set `json_names_for_fields=f
--swagger_out=json_names_for_fields=false:./gen/swagger path/to/my/proto/v1/myproto.proto
```

If using the Bazel rule, set `json_names_for_fields=False`.

## We now emit default vaules for all fields

See [the original issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/233)
Expand Down
6 changes: 3 additions & 3 deletions protoc-gen-swagger/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def _run_proto_gen_swagger(
extra_inputs.append(grpc_api_configuration)
args.add("--swagger_opt", "grpc_api_configuration=%s" % grpc_api_configuration.path)

if json_names_for_fields:
args.add("--swagger_opt", "json_names_for_fields=true")
if not json_names_for_fields:
args.add("--swagger_opt", "json_names_for_fields=false")

proto_file_infos = _direct_source_infos(proto_info)

Expand Down Expand Up @@ -173,7 +173,7 @@ protoc_gen_swagger = rule(
mandatory = False,
),
"json_names_for_fields": attr.bool(
default = False,
default = True,
mandatory = False,
),
"_protoc": attr.label(
Expand Down

0 comments on commit 57089bc

Please sign in to comment.