Generate directly awaitable Rust APIs and response enums - #18
Merged
Merged
Conversation
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.
Rust operation methods returned request builders despite OpenAPI already defining the inputs, bodies and response statuses. Generate async methods that send and decode directly:
client.operation(params).await?returns the operation's status enum, including every declared error response. Remove the generatedRequestwrapper and separate send/decode call pattern.Buffer JSON and raw bodies with a configurable client limit; preserve unread SSE and undeclared responses. Configure custom transport once on the client so application cancellation and HTTP diagnostics cover sending and body decoding while callers use the same direct operation methods. The executable HTTP fixture verifies input encoding, optional/raw bodies, distinct response models, JSON errors, empty statuses, malformed and oversized JSON, and tracing from the active operation span.
Validation: directly awaiting operations failed on the previous generator because
Request<OperationResponse>was not a future. Generator lint, Go tests and all seven Rust contract fixtures passed after the change. The regenerated Listenbox client passed lint and the desktop build. Rootmoon cipassed: 64 actions completed, including all 423 API tests and 87 dashboard browser tests (no failures or retries).Consumer: listenbox/client#23.