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

fix: add additional reserved names for disambiguation #1114

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions gapic/utils/reserved_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
keyword.kwlist,
# We make SOME exceptions for certain names that collide with builtins.
set(dir(builtins)) - {"filter", "map", "id", "input", "property"},
# "mapping" and "ignore_unknown_fields" have special uses
# in the constructor of proto.Message
{"mapping", "ignore_unknown_fields"},
)
)
3 changes: 3 additions & 0 deletions tests/unit/schema/wrappers/test_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ def test_field_name_kword_disambiguation():
)
assert frum_field.name == "frum"

mapping_field = make_field(name="mapping")
software-dov marked this conversation as resolved.
Show resolved Hide resolved
assert mapping_field.name == "mapping_"


def test_field_resource_reference():
field = make_field(name='parent', type='TYPE_STRING')