-
Notifications
You must be signed in to change notification settings - Fork 290
Refactor response format and iterate over pageable items #2665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a615944
to
a57bc38
Compare
API Change CheckAPIView identified API level changes in this PR and created the following API reviews azure_core |
…ead) (#2559) * start building Format/DeserializeWith trait * remove Model and replace with Format type parameter * fix issues in azure_core, azure_identity, and azure_data_cosmos * fix tests in hand-written crates * updates to generated crates * make send_format more clearly a short-cut method * fix async_trait on wasm32 * fix tyop * initial pr feedback * rename DefaultFormat to JsonFormat * paramerize pipeline on format * undo all generated code changes * revert keyvault generated changes * some updates to copilot instructions * split Response into Response and RawResponse * remove extraneous helpers, let's focus on simple APIs and be ok with boilerplate * api doc updates * remove some extraneous copilot instructions * refactor cosmos for new Response types * fix typespec client examples * fix issues in non-generated clients * fix issues in generated clients * a few other hand-written client fixes * update changelog * pr feedback * refmt * fix doctest * fix more doctests * add `F` parameter to `Pager`
* Iterator over items asynchronously from Pager For functions that return a `Pager<T>`, callers will iterate over items across all pages asynchronously by default but can get an async iterator (`Stream`) over pages as well. Resolves #2205 * Update CHANGELOG for PagerResult changes * Resolve PR feedback
286913f
to
10ca8bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates response handling to use the new into_body
/into_raw_body().json()
APIs and flattens pageable results into item streams, along with related documentation and dependency bumps.
- Refactored example code to use
.into_body()
or.into_raw_body().json()
instead of deprecated.into_json_body()
. - Changed pageable iterators to yield items directly rather than pages, and updated README/docs accordingly.
- Bumped dependency versions and updated core HTTP client code to use
RawResponse
in tests and pipelines.
Reviewed Changes
Copilot reviewed 114 out of 115 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
sdk/cosmos/azure_data_cosmos/examples/cosmos/replace.rs | Updated JSON body extraction to new API |
sdk/cosmos/azure_data_cosmos/examples/cosmos/read.rs | Switched to .into_body() for JSON parsing |
sdk/cosmos/azure_data_cosmos/examples/cosmos/query.rs | Flattened pageable iteration to yield items |
sdk/cosmos/azure_data_cosmos/examples/cosmos/patch.rs | Updated JSON body extraction to new API |
sdk/cosmos/azure_data_cosmos/examples/cosmos/create.rs | Updated JSON body extraction to new API |
sdk/cosmos/azure_data_cosmos/README.md | Fixed formatting, updated example body calls |
sdk/cosmos/azure_data_cosmos/CHANGELOG.md | Added breaking change for pager item iteration |
sdk/core/azure_core_test/src/proxy/client.rs | Switched test mocks to use RawResponse |
sdk/core/azure_core_test/src/http/clients.rs | Switched mock client to return RawResponse |
sdk/core/azure_core/src/http/policies/*.rs | Updated policy tests to use RawResponse |
sdk/core/azure_core/src/http/pipeline.rs | Updated pipeline tests to use RawResponse |
sdk/core/azure_core/src/http/mod.rs | Re-exported RawResponse and Response |
sdk/core/azure_core/benches/benchmarks.rs | Updated benchmark mock to return RawResponse |
sdk/core/azure_core/README.md | Clarified pager vs page iteration in examples |
sdk/core/azure_core/Cargo.toml | Adjusted workspace dependency syntax |
sdk/core/azure_core/CHANGELOG.md | Documented new PageIterator and breaking changes |
eng/emitter-package.json | Bumped @azure-tools/typespec-rust and client deps |
.github/copilot-instructions.md | Added new style rules for use directives |
Files not reviewed (1)
- eng/emitter-package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
sdk/core/azure_core/src/http/mod.rs:20
- [nitpick] Re-exporting both
RawResponse
andResponse
may confuse consumers; consider aliasing or exposing only a single, consistent response type.
pub use response::{RawResponse, Response};
This PR should be rebase-merged to maintain history.