-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[rust-server] enhance support for middlewares #552
Conversation
@bjgill thanks for the PR. Is it correct to say that this PR is a breaking change for the Rust client? If yes, we should include it in 3.2.x branch instead. |
@wing328 - this will only be a breaking change if the user has put the Given that However, if it's not acceptable to keep (Also, I've noticed that we weren't previously checking that the example integration compiled, so have just fixed that in the latest commit.) |
In the migration guide, I've updated |
Thanks for the explanation. If this PR is ready to merge, please kindly let me know. |
Thanks. This is ready to merge. |
* Generate RequestParser trait to allow retrieving operation ID in middlewares * Update function name * Fix incomplete comment * Add comment poitning out auotgenerated duplication * Final generation of sample scripts * MMORCH-913 - Allow passing wrapped hyper clients to codegen * Deprecate old API for back-compatibility rather than removing it * Actually test Rust-server example integrations
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,3.1.x
,4.0.x
. Default:master
.Description of the PR
This enhances codegen to generate the new
RequestParser
trait, so middlewares can get the operation ID from a hyperRequest
. This PR also tweaks the autogenerated client to be generic over the future type that the underlying hyper Client returns. This is needed to allow passing wrapped clients - theFutureResponse
type used originally is private to hyper and can't be constructed. This change allows us to wrap the hyper client below the autogen layer but above hyper.I've not done any manual testing of this PR - we've been using this in production for the past month, though, so low risk.
Thanks to @mthebridge, who originally contributed these changes.
Part of the fix for #550