Skip to content

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

Merged
merged 4 commits into from
Jun 6, 2025

Conversation

heaths
Copy link
Member

@heaths heaths commented Jun 4, 2025

This PR should be rebase-merged to maintain history.

@github-actions github-actions bot added Azure.Core The azure_core crate Azure.Identity The azure_identity crate Cosmos The azure_cosmos crate Storage Storage Service (Queues, Blobs, Files) labels Jun 4, 2025
@heaths heaths force-pushed the feature/replace-model-with-format branch from a615944 to a57bc38 Compare June 4, 2025 23:58
Copy link

github-actions bot commented Jun 5, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure_core
azure_data_cosmos
azure_security_keyvault_certificates
azure_security_keyvault_keys
azure_security_keyvault_secrets
azure_storage_blob
typespec_client_core

analogrelay and others added 4 commits June 5, 2025 17:37
…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
@heaths heaths force-pushed the feature/replace-model-with-format branch from 286913f to 10ca8bc Compare June 6, 2025 00:43
@heaths heaths marked this pull request as ready for review June 6, 2025 00:43
@Copilot Copilot AI review requested due to automatic review settings June 6, 2025 00:43
Copy link
Contributor

@Copilot Copilot AI left a 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 and Response may confuse consumers; consider aliasing or exposing only a single, consistent response type.
pub use response::{RawResponse, Response};

@heaths heaths merged commit 2e5baa3 into main Jun 6, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from Untriaged to Done in Azure Identity SDK Improvements Jun 6, 2025
@heaths heaths deleted the feature/replace-model-with-format branch June 6, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core The azure_core crate Azure.Identity The azure_identity crate Cosmos The azure_cosmos crate Storage Storage Service (Queues, Blobs, Files)
Projects
Development

Successfully merging this pull request may close these issues.

4 participants