GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: add field headers for other http verbs by busunkim96 · Pull Request #443 · googleapis/gapic-generator-python

This repository was archived by the owner on Aug 25, 2026. It is now read-only.

Conversation

@busunkim96

@busunkim96 busunkim96 commented Jun 4, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Closes #401

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@busunkim96
fix: add field headers for other http verbs
5bb7d30
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 4, 2020
busunkim96 and others added 3 commits June 4, 2020 14:06
@busunkim96
Merge branch 'master' into field-headers
6c8aeeb
@busunkim96
fix: fix custom path
797da8f
@busunkim96
Merge branch 'field-headers' of github.com:googleapis/gapic-generator…
78359ca
…-python into field-headers
software-dov
software-dov reviewed Jun 5, 2020
View reviewed changes

@software-dov software-dov left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some nitpicky codegolf on my end :P
I'll look into why the tests are failing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread gapic/schema/wrappers.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/schema/wrappers/test_method.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@software-dov

software-dov commented Jun 5, 2020

Copy link
Copy Markdown
Contributor

Ahh, it looks like the generated unit tests aren't getting 100% coverage.
It should be easy to add the new verbs to the generated unit test or, if you're okay with my suggested implementation change, the problem goes away because of the simplified control flow.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

busunkim96 and others added 7 commits June 5, 2020 22:49
@busunkim96
fix: consolidate into one test
85ca6c9
@busunkim96
Merge branch 'master' into field-headers
f569911
@busunkim96
Merge branch 'master' into field-headers
224d81a
@busunkim96
test: update generated unit tests
38e8711
@busunkim96
test: update ads template
afd742a
@busunkim96
fix: don't add field headers to streaming methods
85f9699
@busunkim96
test: exclude header check for client streaming method
8ed787d
@codecov

codecov Bot commented Jun 9, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #443 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #443   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         1453      1453           
  Branches       300       300           
=========================================
  Hits          1453      1453           
Impacted Files Coverage Δ
gapic/schema/wrappers.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update decae37...8ed787d. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

busunkim96
busunkim96 commented Jun 9, 2020
View reviewed changes

@busunkim96 busunkim96 left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the last failing unit test is for a streaming method that uses field headers.

https://github.com/googleapis/gapic-showcase/blob/22ad815971209890549f8f6226f200ae0e3f1688/schema/google/showcase/v1beta1/messaging.proto#L174-L186

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread gapic/templates/tests/unit/%name_%version/%sub/test_%service.py.j2
with mock.patch.object(
type(client._transport.{{ method.name|snake_case }}),
'__call__') as call:
{% if method.void -%}

@busunkim96 busunkim96 Jun 9, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-pasted from the unit test below this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread gapic/templates/tests/unit/%name_%version/%sub/test_%service.py.j2
)
request = {{ method.input.ident }}()

{%- for field_header in method.field_headers %}

@busunkim96 busunkim96 Jun 9, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tweaking this slightly for field headers like "/v1beta1/{endpoint.name=projects/*/locations/*/namespaces/*/services/*/endpoints/*}"

https://github.com/googleapis/googleapis/blob/52701da10fec2a5f9796e8d12518c0fe574488fe/google/cloud/servicedirectory/v1beta1/registration_service.proto#L171-L177

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((
{%- for field_header in method.field_headers %}
{%- if not method.client_streaming %}

@busunkim96 busunkim96 Jun 9, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this for a failing showcase test (see streaming method in proto and failing test).

Not sure if this is the right call though. What's the correct way to handle metadata/headers for streaming methods? @software-dov

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@software-dov software-dov Jun 9, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that headers for streaming methods don't make a lot of sense because they're not tightly bound to http semantics. If that's not correct, then I think we would need to ask someone who knows better.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@busunkim96
busunkim96 requested a review from software-dov June 9, 2020 17:59
software-dov
software-dov approved these changes Jun 9, 2020
View reviewed changes
Comment thread gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((
{%- for field_header in method.field_headers %}
{%- if not method.client_streaming %}

@software-dov software-dov Jun 9, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that headers for streaming methods don't make a lot of sense because they're not tightly bound to http semantics. If that's not correct, then I think we would need to ask someone who knows better.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@software-dov
software-dov merged commit f8e9712 into master Jun 9, 2020
@software-dov
software-dov deleted the field-headers branch June 9, 2020 22:00
@software-dov software-dov mentioned this pull request Jun 9, 2020
Generated clients are missing routing headers #401
Closed
@busunkim96 busunkim96 mentioned this pull request Dec 16, 2020
Client streaming methods should send routing headers googleapis/google-cloud-python#16461
Closed
This was referenced Jan 18, 2022
chore(master): release reverted #1133
Merged
chore(master): release 0.39.1 #1146
Closed
This was referenced Jan 26, 2022
chore(main): release 0.39.1 #1160
Closed
chore(main): release 0.39.1 #1162
Closed
chore(main): release 0.61.0 #1163
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@software-dov software-dov software-dov approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Generated clients are missing routing headers

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@busunkim96 @software-dov @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.