-
Notifications
You must be signed in to change notification settings - Fork 36
feat: error handling + withResponse + includeClient option #92
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
base: main
Are you sure you want to change the base?
Conversation
Adds CLI options for client inclusion and success codes Introduces flags to control API client generation and customize success status codes via the command line, enhancing flexibility for different use cases.
Improves type-safe API error handling and response access Refactors API client response typing to unify success and error data under a consistent interface. Replaces separate error property with direct data access and ensures the Response object retains its methods. Updates documentation with clearer examples for type-safe error handling and data access patterns. Facilitates more ergonomic and predictable client usage, especially for error cases.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces improved type-safe error handling and response access capabilities to the typed OpenAPI client. It adds a withResponse
option that allows developers to access both success and error responses through a unified interface while maintaining backward compatibility.
- Adds
withResponse
parameter to enable type-safe error handling with Response object access - Unifies response data access pattern with consistent
data
property for both success and error cases - Introduces
responses
schema definitions for all endpoints to support proper error typing
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 5 comments.
File | Description |
---|---|
test-new-api.ts | Test file demonstrating the new withResponse API with type inference validation |
packages/typed-openapi/tests/snapshots/*.ts | Updated all client variations (zod, yup, valibot, typebox, io-ts, client, arktype) with new error handling types and withResponse method overloads |
Adds type-safe error handling to TanStack Query generator Introduces discriminated unions and configurable success status codes for more robust error handling in generated TanStack Query clients. Supports advanced mutation options with `withResponse` and `selectFn` to enable granular control over success and error transformations in API responses. Improves documentation to highlight new error handling features and integration patterns.
commit: |
commit: |
Improves type-safe API error handling and response access
Refactors API client response typing to unify success and error data under a consistent interface.
Replaces separate error property with direct data access and ensures the Response object retains its methods.
Updates documentation with clearer examples for type-safe error handling and data access patterns.
Facilitates more ergonomic and predictable client usage, especially for error cases.