Skip to content

Commit abfad56

Browse files
authored
fix(openapi-typescript-helpers): fix SuccessResponseJSON, ErrorResponseJSON and RequestBodyJSON (#1948)
1 parent d6a94f9 commit abfad56

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: .changeset/odd-seahorses-juggle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"openapi-typescript-helpers": patch
3+
---
4+
5+
fix SuccessResponseJSON, ErrorResponseJSON and RequestBodyJSON helpers

Diff for: packages/openapi-typescript-helpers/index.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ export type ErrorResponse<T, Media extends MediaType = MediaType> = FilterKeys<
131131
>;
132132

133133
/** Return first JSON-like 2XX response from a path + HTTP method */
134-
export type SuccessResponseJSON<PathMethod> = SuccessResponse<ResponseObjectMap<PathMethod>>;
134+
export type SuccessResponseJSON<PathMethod> = SuccessResponse<ResponseObjectMap<PathMethod>, `${string}/json`>;
135135

136136
/** Return first JSON-like 5XX or 4XX response from a path + HTTP method */
137-
export type ErrorResponseJSON<PathMethod> = ErrorResponse<ResponseObjectMap<PathMethod>>;
137+
export type ErrorResponseJSON<PathMethod> = ErrorResponse<ResponseObjectMap<PathMethod>, `${string}/json`>;
138138

139139
/** Return JSON-like request body from a path + HTTP method */
140-
export type RequestBodyJSON<PathMethod> = FilterKeys<OperationRequestBody<PathMethod>, "content">;
140+
export type RequestBodyJSON<PathMethod> = JSONLike<FilterKeys<OperationRequestBody<PathMethod>, "content">>;
141141

142142
// Generic TS utils
143143

0 commit comments

Comments
 (0)