-
Notifications
You must be signed in to change notification settings - Fork 375
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
refactor(generator): prepare for dynamic query params #14596
refactor(generator): prepare for dynamic query params #14596
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14596 +/- ##
==========================================
- Coverage 93.59% 93.59% -0.01%
==========================================
Files 2316 2316
Lines 207019 207084 +65
==========================================
+ Hits 193756 193813 +57
- Misses 13263 13271 +8 ☔ View full report in Codecov by Sentry. |
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.
Reviewed 1 of 123 files at r1.
Reviewable status: 1 of 123 files reviewed, 1 unresolved discussion (waiting on @dbolduc)
generator/integration_tests/golden/v1/internal/golden_thing_admin_rest_stub.cc
line 73 at r1 (raw file):
std::thread t{[]( auto p, auto service, auto request, auto rest_context, auto options) { std::vector<std::pair<std::string, std::string>> query_params;
Do we want to emit this code when there are no query parameters?
I do. And the ghost of @devbww would. (He would say: no default parameters for internal functions). I think it is easier to do the same thing all the time instead of handling an empty vector as a special case. |
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.
Fair enough, but let's remove the call to TrimQueryParameters
when there are no parameters. I'm pretty sure the optimizer cannot reason about a function in another TU and will have to always call it.
Reviewable status: 1 of 123 files reviewed, 1 unresolved discussion (waiting on @dbolduc)
I am not worried about calling a function that returns immediately when compared with the subsequent network call.... but it is easy enough to do, so done. |
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.
Reviewed 1 of 117 files at r2.
Reviewable status: 1 of 123 files reviewed, 1 unresolved discussion (waiting on @dbolduc)
Part of the work for #14492, #10176
To support repeated fields and arbitrary message nesting, we will need to dynamically add the query parameters. An initializer list cannot handle that complexity.
This PR just refactors the construction of the query parameters (in generated code) to prepare for adding loops and such, e.g.: dbolduc@7874e79
This change is