Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Description

Linear ticket: N/A (Customer request from Slack thread)

Implements a customer feature request to make the response property on paginated responses publicly accessible and properly typed. Previously, the response property was private and typed as unknown/any, preventing customers from accessing the full response object when using auto-pagination.

Link to Devin run: https://app.devin.ai/sessions/a5cea20fb1604fb5ace37cb53b05a09d
Requested by: [email protected] (@tjb9dc)

Changes Made

  • Added second generic parameter R to Page class for response type (defaults to unknown for backward compatibility)
  • Changed response property from private response: unknown to public response: R
  • Updated all internal method signatures to use properly typed R instead of unknown
  • Updated Pageable class to correctly pass response type to parent Page<T, R> class
  • Removed unnecessary as any cast in Pageable constructor
  • Updated README.md generator (if applicable) - N/A

Testing

  • Manual testing completed - Ran pagination seed test which passed successfully
  • Unit tests added/updated - No new unit tests needed; existing tests cover the functionality

Test output: The pagination fixture test passed, confirming that:

  1. Generated code compiles without errors
  2. The response property is now public and properly typed with the response type (e.g., Pageable<ListUsersPaginationResponse, User>)
  3. Backward compatibility is maintained with the default R = unknown parameter

Important Review Points

  1. Backward Compatibility: The default generic parameter R = unknown ensures existing code using Page<T> continues to work. Verify no breaking changes in other parts of the codebase.

  2. Generator Integration: The TypeScript generator already passes both type parameters when instantiating Pageable (verified in seed output at lines like new core.Pageable<SeedPagination.ListUsersPaginationResponse, SeedPagination.User>). Confirm this pattern is consistent across all pagination scenarios.

  3. Type Safety: The response property is now public. While this was explicitly requested, confirm this doesn't expose unintended implementation details or create security concerns.

  4. Test Coverage: Only the pagination fixture was tested. Consider whether additional seed tests or real-world scenarios should be validated before merging.

- Updated Page class to accept a second generic parameter R for response type
- Changed response property from private to public
- Response property is now properly typed instead of using 'unknown' or 'any'
- Updated Pageable class to pass response type to parent Page class
- Maintains backward compatibility with R = unknown default

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 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

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