Fix axum doctest examples; infer Json early responses; forward OperationIo early responses#285
Closed
kieled wants to merge 1 commit intotamasfe:mainfrom
Closed
Fix axum doctest examples; infer Json early responses; forward OperationIo early responses#285kieled wants to merge 1 commit intotamasfe:mainfrom
kieled wants to merge 1 commit intotamasfe:mainfrom
Conversation
Collaborator
|
Please split into at least two PRs (docs, |
This was referenced Feb 7, 2026
Author
|
Split per review request:
This PR is superseded by those two. |
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.
Fixes #255.
Fixes #272.
Fixes #235.
This PR addresses two high-impact adoption pain points:
axum::serve(...)which is feature-gated in axum (tokio + http1/http2). Withaxumused withdefault-features = false,axum::serveis not always available, causing doctest failures.aide::axumexample also unnecessarily forced the/api.jsonroute throughIntoApiResponseeven though it is not documented (added via.route, not.api_route).Changes:
crates/aide/src/axum/mod.rscrates/aide/src/redoc/mod.rscrates/aide/src/swagger/mod.rscrates/aide/src/scalar/mod.rsto avoid calling
axum::servein doctests.routing::get+IntoResponsefor the non-documented/api.jsonhandler in theaide::axumdocs example.OperationIowithinput_with = ...previously delegatedoperation_inputbut did not delegateOperationInput::inferred_early_responses, so early responses were silently dropped.axum::Json<T>did not provide inferred early responses, even though axum returns rejections before the handler body for invalid JSON and content-type mismatches.Changes:
OperationIonow forwardsinferred_early_responseswheninput_withis used.axum::Json<T>now reports inferred early responses:Content-Type: application/jsonTests:
OperationIoforwarding ofinferred_early_responsesaxum::Json<T>inferred early response status codesCommands run:
cargo test -p aide --doc --all-featurescargo test --workspace --all-featurescargo build --examples --all-features(These changes should also reduce confusion seen in #278 and #265 by removing common docs-triggered failure modes.)