feat: query parameters support - #5
Merged
Merged
Conversation
dotkas
force-pushed
the
dotkas/query-header-params
branch
from
June 29, 2026 07:05
7153100 to
285c201
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds server-side query parameter support to the oapi-codegen-rust axum server generator by lowering OpenAPI query params into per-operation structs and wiring them through axum_extra::extract::Query.
Changes:
- Lower query parameters into an IR
Struct(Operation.query) and emit it plus the corresponding axum extractor in generated handlers. - Extend the bookstore example and README to demonstrate query parameters, including adding
axum-extraas a dependency. - Add generation fixtures and compile tests to cover supported query params and ensure unsupported shapes fail generation.
Reviewed changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new query-parameter support and the axum-extra dependency requirement. |
| examples/bookstore/tests/smoke.rs | Implements the new list_books API method consuming generated query struct. |
| examples/bookstore/openapi.yaml | Adds a GET /books operation with query parameters to exercise generation end-to-end. |
| examples/bookstore/generated/restapi.rs | Regenerates server code: query struct, trait signature change, new handler + route. |
| examples/bookstore/Cargo.toml | Adds axum-extra dependency needed by generated query extractor usage. |
| crates/oapi-codegen/tests/generated/server_query_params.rs | New golden generated output covering query param structs + handler extractor. |
| crates/oapi-codegen/tests/generated_compiles.rs | Adds a compile test ensuring generated query extractor type-checks. |
| crates/oapi-codegen/tests/fixtures/server_unsupported_object_query_param.yaml | New fixture asserting object-shaped query params are rejected. |
| crates/oapi-codegen/tests/fixtures/server_query_params.yaml | New fixture asserting scalar/array/required query params are supported. |
| crates/oapi-codegen/tests/coverage.rs | Extends coverage matrix to include query-param server fixture(s). |
| crates/oapi-codegen/src/paths.rs | Implements query-param lowering and scalar/array validation logic. |
| crates/oapi-codegen/src/ir.rs | Adds Operation.query: Option<Struct> to carry query struct through IR. |
| crates/oapi-codegen/src/emit.rs | Emits query structs and injects axum_extra::extract::Query extractor + method arg. |
| crates/oapi-codegen/Cargo.toml | Adds axum-extra as a dev-dependency for generated server compilation tests. |
| Cargo.lock | Locks new transitive deps from adding axum-extra. |
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.