GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: add grpc transcoding, clean up unimplemented rest method/test generation by yon-mg · Pull Request #776 · googleapis/gapic-generator-python
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Conversation
Contributor
This pr introduces usage of grpc transcoding and is reliant on changes made to to, With this implementation of grpc transcoding, there are a few more changes that need to be made to ensure Showcase tests can run correctly. LRO rpcs, streaming rpcs and rpcs without
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
yon-mg
requested review from
a team,
software-dov,
vam-google and
vchudnov-g
|
There was an error while loading. Please reload this page.
Codecov Report
@@ Coverage Diff @@ ## master #776 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 26 27 +1 Lines 1608 1642 +34 Branches 328 333 +5 ========================================= + Hits 1608 1642 +34
Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| for http_rule in http_options: | ||
| try: | ||
| method, uri = next((method, uri) for method,uri in [ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Formatting nit: for method, uri
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| method, uri = next((method, uri) for method,uri in [ | ||
| ('get',http_rule.get), | ||
| ('put',http_rule.put), | ||
| ('post',http_rule.post), | ||
| ('delete',http_rule.delete), | ||
| ('patch',http_rule.patch), | ||
| ('custom.path',http_rule.custom.path), | ||
| ] if uri | ||
| ) | ||
| except StopIteration: | ||
| continue |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think it's better not to catch a StopIteration and instead use explicit control flow.
This is a fairly common pattern when using next:
thing = next((generator_expression_or_iterable), None) # Or (None, None) if detupling if not thing: continue # Or do some other action
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @property | ||
| def {{ method.name|snake_case }}(self) -> Callable[ | ||
| [{{ method.input.ident }}], | ||
| {{ method.output.ident }}]: | ||
| return self._{{ method.name|snake_case }} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why the extra indirection? Is it removable?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Jsonify the query params | ||
| query_params = json.loads({{ method.input.ident }}.to_json( | ||
| {{ method.input.ident }}(transcoded_request['query_params']), | ||
| including_default_value_fields=False, | ||
| use_integers_for_enums=False | ||
| )) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm misunderstanding something, this is turning the transcoded request back into a Request message object, turning it into a JSON string, and then turning it back into a python dict. Is that correct? Can we use to_dict instead of the indirection?
If the above is correct, can you add some comments describing the dataflow? If it's not correct, then could you describe what the dataflow is?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
for the record: this is actually not redundant, provided we want to rely on proto+ to do the proper case conversion. to_dict doesn't do the conversion from snake_case to camelCase, only to_json does that. But the result of to_json is a string that can't be used as-is to construct the query string.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return {{ method.output.ident }}.from_json(response.content) | ||
| {%- else %} | ||
|
|
||
| # Returh the response |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: Return the response
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| {%- endfor %} | ||
| ) | ||
|
|
||
| <<<<<<< HEAD |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cruft
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| {%- endif %} in http_call[1] + str(body) + str(query_params.values()) | ||
| {% endif %} | ||
| {% endif %}{% endfor %} | ||
| ======= |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cruft
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| {%- endif %} in http_call[1] + str(body) | ||
| {% endif %} | ||
| {% endif %}{% endfor %} | ||
| >>>>>>> upstream/master |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cruft
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi @yon-mg , I'm going to close this PR due to inactivity but please feel free to re-open it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This is still needed for REGAPIC Python. Please do not close it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.