-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Added support for a trait based reqwest Rust client #19788
Conversation
not related to this change |
{{/reqwestTrait}} | ||
|
||
[features] | ||
{{#mockall}} |
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.
what about putting [features]
inside the mockall
mustache tags?
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.
@wing328 I thought about that originally, but figured it would be easier to always add [features]
so adding new features in the future would be easier.
ie.
[features]
{{#mockall}}
mockall = ["dep:mockall"]
{{/mockall}}
{{#foo}}
foo = ["dep:foo"]
{{/foo}}
{{#bar}}
bar = ["dep:bar"]
{{/bar}}
But I do not have a strong opinion on this, we can change if there is a reason to 👍
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.
that's ok. i may file a PR later to update it
I went ahead and added support for the 2 things I need:
|
@TroyKomodo Thanks! |
can you please commit the updated samples and docs one more time? |
Adds support for single argument and bon building for the new reqwest-trait generator
Sure, I just pushed a commit rebuilding them. 👍 |
thanks for the PR let's give it a try to see if the community has any feedback/suggestion on this new generator |
This PR added a new
reqwest-trait
generator that was requested in #11319.This implementation uses traits as the primary interface using APIs. This has 2 primary benefits
configuration::Configuration
to all API calls as we now store that in the implementing struct.I also added 2 small QoL features in this sub-library:
mockall
option (defaults to OFF) that adds the mockall crate to make testing much easier.topLevelApiClient
option (defaults to OFF) that adds a top levelApi
trait andApiClient
struct that serves a container. This makes managing APIs with many tags much easier as we only need to construct one client instead of many.PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)