emit the dart http_rest client beside the typescript half - #285
Merged
Conversation
Every service publishes dart_http_client(): an abstract transport interface over Dart 3 records (the interface is the only per-service name), and a client whose methods build path, query and headers through the shared http shape, decode by status, and answer in Dart's own idiom - a reply operation returns its success and throws the typed error, a one-way operation returns void and throws a refusal - rather than transplanting the TypeScript result envelope. Faults reuse the fault class and kind enum the dart backend already publishes. No outbound validation is emitted: a Dart message is a real class whose required constructor arguments cannot express the malformed value the other languages guard against. Bytes operations answer the byte list with its content type, read bare. There is no streamed arm to forget: the body-kind matches are exhaustive, so the compiler revisits this file when that variant lands.
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.
The Dart sibling of the TypeScript http client, emitted by
dart_http_client()under thedartfeature. One abstract transport interface per service over Dart 3 records — no HTTP package named (asserted). Methods build path/query/headers through the sharedHttpShape/ScalarKindjudgements, decode by status (ok_status,error_status, the 422 default binding, fixed fault codes through the already-generated fault class), and answer in Dart idiom: replies return success and throw the typed error; one-way returns void and throws a refusal — a deliberate, documented departure from TypeScript's result envelope. Bytes operations return the byte list + content type; the body-kind matches are exhaustive so a future streamed variant fails compile here rather than silently missing.16 string-level tests cover the seam shape, building, every decode branch, defaults, header read-back, one-way, and bytes.
Gate:
just lint,just test-named-features,cargo test --all-featuresgreen on the tree merged with master.