feat: blocking reqwest client generator - #20
Merged
Conversation
dotkas
force-pushed
the
dotkas/reqwest-generator
branch
from
July 7, 2026 17:55
467412b to
bca03c1
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new code generation mode to oapi-codegen that emits a blocking reqwest client from the same lowered Service IR used by the axum server generator, along with new fixtures/snapshot outputs and coverage harness updates to validate the generated client output.
Changes:
- Introduces a new
generate.clientconfig knob and wires it through CLI/config plumbing to emit a blockingreqwestclient. - Adds a new
emit/reqwest.rsclient emitter (typed responses, per-op methods, and an operation-shape rejection gate). - Extends the test/coverage framework with client fixtures, a committed generated client snapshot, and compile/runtime checks.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new generate.client knob, supported/rejected shapes, and dependency requirements. |
| crates/oapi-codegen/tests/generated/client_widgets.rs | New committed snapshot of generated client+models output for the client_widgets fixture. |
| crates/oapi-codegen/tests/generated_compiles.rs | Includes the new generated client snapshot for compile-checking and adds a small runtime smoke test. |
| crates/oapi-codegen/tests/fixtures/client_widgets.yaml | New supported fixture exercising client params, bodies, and responses. |
| crates/oapi-codegen/tests/fixtures/client_unsupported_negotiated_response.yaml | New unsupported fixture for negotiated responses. |
| crates/oapi-codegen/tests/fixtures/client_unsupported_negotiated_request.yaml | New unsupported fixture for negotiated requests. |
| crates/oapi-codegen/tests/fixtures/client_unsupported_multipart_request.yaml | New unsupported fixture for multipart request bodies. |
| crates/oapi-codegen/tests/fixtures/client_unsupported_form_response.yaml | New unsupported fixture for form response bodies. |
| crates/oapi-codegen/tests/coverage.rs | Adds client fixture catalogs and snapshot/unsupported rejection checks; updates compile-check coverage. |
| crates/oapi-codegen/src/main.rs | Updates “nothing to generate” guard to include generate.client. |
| crates/oapi-codegen/src/lib.rs | Wires generate.client into the main generation pipeline and ensures models are emitted when client/server is requested. |
| crates/oapi-codegen/src/emit/reqwest.rs | New blocking reqwest client emitter implementation. |
| crates/oapi-codegen/src/emit/mod.rs | Adds ClientEmitter trait and emit_with_client entrypoint. |
| crates/oapi-codegen/src/config.rs | Adds Generate::client configuration field. |
| crates/oapi-codegen/Cargo.toml | Adds reqwest as a dev-dependency to type-check generated client code. |
| Cargo.lock | Locks new transitive deps from reqwest. |
Contributor
|
🎉 This PR is included in version 1.0.0-dev.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Contributor
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.