Title: Modified reserved word field names included in field masks. · Issue #227 · googleapis/python-api-core · GitHub
Open Graph Title: Modified reserved word field names included in field masks. · Issue #227 · googleapis/python-api-core
X Title: Modified reserved word field names included in field masks. · Issue #227 · googleapis/python-api-core
Description: I'm not sure whether this is an issue with this library, the generator or the field mask helper, but it seems to be incorrect behavior that's blocking for Ads users, unless there's a workaround or other solution I'm not aware of: Environ...
Open Graph Description: I'm not sure whether this is an issue with this library, the generator or the field mask helper, but it seems to be incorrect behavior that's blocking for Ads users, unless there's a workaround or ...
X Description: I'm not sure whether this is an issue with this library, the generator or the field mask helper, but it seems to be incorrect behavior that's blocking for Ads users, unless there's a wo...
Opengraph URL: https://github.com/googleapis/python-api-core/issues/227
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Modified reserved word field names included in field masks.","articleBody":"I'm not sure whether this is an issue with this library, the [`generator`](https://github.com/googleapis/gapic-generator-python) or the [`field mask helper`](https://github.com/googleapis/python-api-core/blob/master/google/api_core/protobuf_helpers.py#L290), but it seems to be incorrect behavior that's blocking for Ads users, unless there's a workaround or other solution I'm not aware of:\r\n\r\n#### Environment details\r\n\r\n - Programming language: `Python`\r\n - OS: `gLinux`\r\n - Language runtime version: `3.7.0`\r\n - Package version: `1.18.1`\r\n\r\n#### Steps to reproduce\r\n\r\nAssuming we have a protobuf definition like the following:\r\n\r\n```\r\nmessage HasType {\r\n string type = 1;\r\n}\r\n```\r\n\r\nWe'll have a generated Python class similar to:\r\n\r\n```py\r\nclass HasType(proto.Message):\r\n type_ = proto.Field(proto.STRING, number=1,)\r\n```\r\n\r\nWhere `type` has been modified to `type_`. \r\n\r\nNormally setting `type_` isn't a problem, the issue is that this modified field name gets leaked into field masks, which are revoked by the API because it doesn't match the protobuf definition. This prevents users from executing update requests where the `type` field on any object has been modified. \r\n\r\nHere's a short script to reproduce:\r\n\r\n```py\r\nfrom google.api_core import protobuf_helpers\r\nimport proto\r\n\r\nclass HasType(proto.Message):\r\n type_ = proto.Field(proto.STRING, number=1,)\r\n\r\nht = HasType()\r\nht.type_ = \"has type\"\r\n\r\nfm = protobuf_helpers.field_mask(None, ht._pb)\r\n\r\nprint(fm.paths[0])\r\n# \u003e\u003e\u003e \"type_\"\r\n```\r\n","author":{"url":"https://github.com/BenRKarl","@type":"Person","name":"BenRKarl"},"datePublished":"2021-06-29T17:10:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/227/python-api-core/issues/227"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fe4cf007-7e43-67b2-3568-68f35f173d43 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E74:622FF:9B2867:DF7DD3:6A4E41F0 |
| html-safe-nonce | d8aa007df180558c3500174443ca9d642092303728ff15bb6aecf5b745bf0973 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTc0OjYyMkZGOjlCMjg2NzpERjdERDM6NkE0RTQxRjAiLCJ2aXNpdG9yX2lkIjoiMzk5OTk4NDA5NDg3NjE1NjQwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b39ab61c72b5bab5d90dcc69a8663970d840f3ea1a7e936b816cd14fc4f58b3f |
| hovercard-subject-tag | issue:944866748 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-api-core/227/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a62c8d109574afe92f77921e84fb9ed914103ae31991238f4facee3d6c9d371d/googleapis/python-api-core/issues/227 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a62c8d109574afe92f77921e84fb9ed914103ae31991238f4facee3d6c9d371d/googleapis/python-api-core/issues/227 |
| og:image:alt | I'm not sure whether this is an issue with this library, the generator or the field mask helper, but it seems to be incorrect behavior that's blocking for Ads users, unless there's a workaround or ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BenRKarl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/python-api-core git https://github.com/googleapis/python-api-core.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 226992456 |
| octolytics-dimension-repository_nwo | googleapis/python-api-core |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 226992456 |
| octolytics-dimension-repository_network_root_nwo | googleapis/python-api-core |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9fabff9b8b127e686a3ec86f91422e818056ca2c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width