fix api reports

Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com>
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
Aramis Sennyey
2024-04-01 10:24:47 -04:00
committed by aramissennyeydd
parent 92051737af
commit 4ab164dd86
6 changed files with 263 additions and 364 deletions
@@ -19,11 +19,9 @@ import { PathTemplate, ValueOf } from './common';
export type EndpointMap = Record<
string,
{ query?: object; body?: object; response: object | void; path?: object }
{ query?: object; body?: object; response?: object; path?: object }
>;
type UnknownIfVoid<T> = T extends void ? unknown : T;
// OpenAPI generator doesn't emit regular lowercase 'delete'.
type HttpMethods = 'all' | 'put' | 'get' | 'post' | '_delete';
@@ -51,7 +49,7 @@ type ResponseBody<
Method extends DocEndpointMethod<Doc, Endpoint>,
> = `#${Method}|${Endpoint}` extends keyof Doc
? 'response' extends keyof Doc[`#${Method}|${Endpoint}`]
? UnknownIfVoid<Doc[`#${Method}|${Endpoint}`]['response']>
? Doc[`#${Method}|${Endpoint}`]['response']
: unknown
: unknown;
type QuerySchema<