Skip to content

Commit

Permalink
fix(openapi-typescript-helpers): fix SuccessResponseJSON, ErrorRespon…
Browse files Browse the repository at this point in the history
…seJSON and RequestBodyJSON (#1948)
  • Loading branch information
piousdeer authored Oct 25, 2024
1 parent d6a94f9 commit abfad56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-seahorses-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-typescript-helpers": patch
---

fix SuccessResponseJSON, ErrorResponseJSON and RequestBodyJSON helpers
6 changes: 3 additions & 3 deletions packages/openapi-typescript-helpers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ export type ErrorResponse<T, Media extends MediaType = MediaType> = FilterKeys<
>;

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

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

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

// Generic TS utils

Expand Down

0 comments on commit abfad56

Please sign in to comment.