-
Notifications
You must be signed in to change notification settings - Fork 318
Description
Relevant code can be found in this PR: #3284 (this issue was identified when working on an unrelated feature).
When generating against v0.25 of typespec-rust emitter package version, it seems that pageable operations now return a Pager rather than a PageIterator. For example:
// Old
pub fn list_blob_flat_segment(
&self,
options: Option<BlobContainerClientListBlobFlatSegmentOptions<'_>>,
) -> Result<PageIterator<Response<ListBlobsFlatSegmentResponse, XmlFormat>>> {
// New
pub fn list_blob_flat_segment(
&self,
options: Option<BlobContainerClientListBlobFlatSegmentOptions<'_>>,
) -> Result<Pager<ListBlobsFlatSegmentResponse>> {Our test code does the following:
- Create a test container
- Create 2 test blobs, upload them
- Call list_blobs simplest form, no options
- Work with the return type to do a simple assertion against the blobs returned
Attached below is our old code and against the newly refactored code:
// Old (against PageIterator)
let mut list_blobs_response = container_client.list_blobs(None)?;
let page = list_blobs_response.try_next().await?;
let list_blob_segment_response = page.unwrap().into_body()?;
let blob_list = list_blob_segment_response.segment.blob_items;
for blob in blob_list {
let blob_name = blob.name.unwrap().content.unwrap();
let properties = blob.properties.unwrap();
let blob_type = properties.blob_type.unwrap();
let etag = properties.etag;
assert!(blob_names.contains(&blob_name));
assert_eq!(BlobType::BlockBlob, blob_type);
assert!(etag.is_some());
}
// New (against Pager)
let mut list_blobs_response = container_client.list_blobs(None)?;
while let Some(blob_result) = list_blobs_response.next().await {
let blob = blob_result?;
let blob_name = blob.name.unwrap().content.unwrap();
let properties = blob.properties.unwrap();
let blob_type = properties.blob_type.unwrap();
let etag = properties.etag;
assert!(blob_names.contains(&blob_name));
assert_eq!(BlobType::BlockBlob, blob_type);
assert!(etag.is_some());
}Could you advise how to deal with this error we are facing?
Error: Error { context: Custom(Custom { kind: DataConversion, error: Error("expected value", line: 1, column: 1) }) }
This break occurs in multiple places (all of our list blobs across the different client types, the perf-testing, etc.). Thanks!
Note: For sanity, the XML body is coming back correctly when observing in Fiddler, so it seems like the break is how we process the response.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status