Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion gapic/utils/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ def tweak_path(p):
"TRUE",
)

# `rest-numeric-enums` is False by default. Make sure users can also disable
# it by passing `rest-numeric-enums=False`.
rest_numeric_enums = opts.pop("rest-numeric-enums", ["False"])[0] in (
"True",
"true",
"T",
"t",
"TRUE",
)

# NOTE: Snippets are not currently correct for the alternative (Ads) templates
# so always disable snippetgen in that case
# https://github.com/googleapis/gapic-generator-python/issues/1052
Expand Down Expand Up @@ -197,7 +207,7 @@ def tweak_path(p):
# transport should include desired transports delimited by '+', e.g. transport='grpc+rest'
transport=opts.pop("transport", ["grpc"])[0].split("+"),
service_yaml_config=service_yaml_config,
rest_numeric_enums=bool(opts.pop("rest-numeric-enums", False)),
rest_numeric_enums=rest_numeric_enums,
proto_plus_deps=proto_plus_deps,
gapic_version=opts.pop("gapic-version", ["0.0.0"]).pop(),
)
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/generator/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def test_options_bool_flags():
options = Options.build("autogen-snippets=False")
assert not options.autogen_snippets

options = Options.build("rest-numeric-enums=False")
assert not options.rest_numeric_enums


def test_options_autogen_snippets_false_for_old_naming():
# NOTE: Snippets are not currently correct for the alternative (Ads) templates
Expand Down