Skip to content

Conversation

@jsklan
Copy link
Contributor

@jsklan jsklan commented Jan 9, 2026

Description

Refs: Customer bug report (Square)

Fixes wire test failures when pagination tests call getNextPage(). The SDK correctly sends the cursor from the response, but the mock server was rejecting the request because the cursor value didn't match the original request body.

Link to Devin run: https://app.devin.ai/sessions/569f5162819c47c4ba95afbfde8313de
Requested by: @jsklan

Changes Made

  • Added WithJsonOptions interface to withJson.ts with an ignoredFields parameter for specifying fields to ignore during request body comparison
  • Updated mockEndpointBuilder.ts to pass ignoredFields through the jsonBody method
  • Updated TestGenerator.ts to extract pagination cursor field names from the IR and pass them to the mock server at code generation time (only for top-level cursor fields, since nested pagination.* fields are already filtered)
  • Added test fixture listWithTopLevelBodyCursorPagination with a top-level cursor field in the request body to demonstrate the bug
  • Updated README.md generator (not applicable)

Testing

  • Seed tests pass for pagination fixture (2/2 test cases)
  • Verified generated test includes { ignoredFields: ["cursor"] } for the new endpoint
  • Manual testing completed against customer's Square SDK - all 659 tests pass

Updates Since Last Revision

  • Updated Swift SDK snapshot (pagination.swift) to include the new /users/top-level-cursor endpoint path

Human Review Checklist

  • Verify the new listWithTopLevelBodyCursorPagination endpoint properly demonstrates the bug (top-level cursor field, not nested under pagination.)
  • Verify the IR metadata extraction logic in TestGenerator.ts correctly identifies top-level cursor fields (propertyPath == null || propertyPath.length === 0)
  • Verify the 3-commit structure: (1) fixture + buggy output, (2) generator fix, (3) fixed output
  • Confirm the Swift SDK snapshot update is expected (new endpoint added to pagination fixture)

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot changed the title fix(ts-sdk): ignore top-level cursor mismatches in wire test mock server fix(typescript): ignore top-level cursor mismatches in wire test mock server Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants