Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64fb689

Browse files
Version Packages (#97)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent137c613 commit64fb689

File tree

3 files changed

+35
-28
lines changed

3 files changed

+35
-28
lines changed

‎.changeset/true-lemons-think.md‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎packages/typed-openapi/CHANGELOG.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
#typed-openapi
22

3+
##2.0.0
4+
5+
###Major Changes
6+
7+
- 8f1eaa5: Add comprehensive type-safe error handling and configurable status codes
8+
9+
-**Type-safe error handling**: Added discriminated unions for API responses with`SafeApiResponse` and
10+
`InferResponseByStatus` types that distinguish between success and error responses based on HTTP status codes
11+
-**TypedResponseError class**: Introduced`TypedResponseError` that extends the native Error class to include typed
12+
response data for easier error handling
13+
- Expose`successStatusCodes` and`errorStatusCodes` arrays on the generated API client instance for runtime access
14+
-**withResponse parameter**: Enhanced API clients to optionally return both the parsed data and the original Response
15+
object for advanced use cases
16+
-**throwOnStatusError option**: Added`throwOnStatusError` option to automatically throw`TypedResponseError` for
17+
error status codes, simplifying error handling in async/await patterns, defaulting to`true` (unless`withResponse`
18+
is set to true)
19+
-**TanStack Query integration**: The above features are fully integrated into the TanStack Query client generator:
20+
- Advanced mutation options supporting`withResponse` and`selectFn` parameters
21+
- Automatic error type inference based on OpenAPI error schemas instead of generic Error type
22+
- Type-safe error handling with discriminated unions for mutations
23+
- Response-like error objects that extend Response with additional`data` property for consistency
24+
-**Configurable status codes**: Made success and error status codes fully configurable:
25+
- New`--success-status-codes` and`--error-status-codes` CLI options
26+
-`GeneratorOptions` now accepts`successStatusCodes` and`errorStatusCodes` arrays
27+
- Default error status codes cover comprehensive 4xx and 5xx ranges
28+
-**Enhanced CLI options**: Added new command-line options for better control:
29+
-`--include-client` to control whether to generate API client types and implementation
30+
-`--include-client=false` to only generate the schemas and endpoints
31+
-**Enhanced types**: expose`SuccessStatusCode` /`ErrorStatusCode` type and their matching runtime typed arrays
32+
-**Comprehensive documentation**: Added detailed examples and guides for error handling patterns
33+
34+
This release significantly improves the type safety and flexibility of generated API clients, especially for error
35+
handling scenarios.
36+
337
##1.5.1
438

539
###Patch Changes

‎packages/typed-openapi/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name":"typed-openapi",
33
"type":"module",
4-
"version":"1.5.1",
4+
"version":"2.0.0",
55
"main":"dist/index.js",
66
"module":"dist/index.js",
77
"exports": {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp