Skip to content

Add tests for nested paging with XML-like structures #7798

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 2, 2025

This PR adds comprehensive tests for nested paging scenarios similar to XML structures, addressing the request to test nested paging functionality with XML-like data hierarchies.

Changes Made

Added three new test cases to packages/compiler/test/decorators/paging.test.ts:

1. Basic nested XML-like structure test

Tests a scenario similar to Azure Storage blob listing:

model BlobFlatListSegment {
  @pageItems
  blobItems: string[];
}

model ListBlobsFlatSegmentResponse {
  containerName: string;
  segment: BlobFlatListSegment;
  @continuationToken
  nextMarker?: string;
}

2. Deeply nested structure test

Tests paging properties across multiple levels of nesting:

model NestedResponse {
  data: {
    itemsContainer: ItemsContainer;
    paginationInfo: PaginationInfo;
  };
}

3. Complex Azure Storage-like scenario

Tests a comprehensive nested structure with metadata and proper XML-style hierarchy.

Validation

The tests verify that:

  • @pageItems can be found in deeply nested structures (e.g., enumerationResults.segment.blobItems)
  • @continuationToken can be found in complex nested responses (e.g., enumerationResults.nextMarker)
  • Input continuation tokens are properly identified
  • The paging operation parser correctly navigates nested object structures

All tests use TypeSpec models that represent the hierarchical structure mentioned in the original issue, demonstrating that nested paging works correctly with XML-like data structures that would be suitable for use with XML decorators like @Xml.name, @Xml.unwrapped, and @Xml.attribute.

Fixes #7797.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] [specs] add test for nested paging in xml Add tests for nested paging with XML-like structures Jul 2, 2025
@Copilot Copilot AI requested a review from catalinaperalta July 2, 2025 01:15
Copilot finished work on behalf of catalinaperalta July 2, 2025 01:15
@catalinaperalta
Copy link
Member

@copilot only add tests under the packages/http-specs directory. Remove the other tests you added.

Copy link
Contributor Author

Copilot AI commented Jul 2, 2025

@copilot only add tests under the packages/http-specs directory. Remove the other tests you added.

Done! I've moved the nested paging tests to packages/http-specs/specs/payload/pageable/main.tsp and removed all tests from the compiler directory and XML files. The tests now follow the http-specs scenario format with @scenario and @scenarioDoc decorators. (ad2da38)

Copilot finished work on behalf of catalinaperalta July 2, 2025 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[specs] add test for nested paging in xml
2 participants