fix(typescript): ignore top-level cursor mismatches in wire test mock server #11490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
WithJsonOptionsinterface towithJson.tswith anignoredFieldsparameter for specifying fields to ignore during request body comparisonmockEndpointBuilder.tsto passignoredFieldsthrough thejsonBodymethodTestGenerator.tsto 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 nestedpagination.*fields are already filtered)listWithTopLevelBodyCursorPaginationwith a top-level cursor field in the request body to demonstrate the bugTesting
{ ignoredFields: ["cursor"] }for the new endpointUpdates Since Last Revision
pagination.swift) to include the new/users/top-level-cursorendpoint pathHuman Review Checklist
listWithTopLevelBodyCursorPaginationendpoint properly demonstrates the bug (top-level cursor field, not nested underpagination.)TestGenerator.tscorrectly identifies top-level cursor fields (propertyPath == null || propertyPath.length === 0)