From dfdfc8fab42d2005cc305b35f77b3142c06abd14 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 26 May 2023 07:53:19 +0000 Subject: [PATCH] wip --- packages/misskey-js/src/endpoints.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/misskey-js/src/endpoints.ts b/packages/misskey-js/src/endpoints.ts index 43475d8709..bdf9a5b29b 100644 --- a/packages/misskey-js/src/endpoints.ts +++ b/packages/misskey-js/src/endpoints.ts @@ -962,6 +962,12 @@ export const endpoints = { }, } as const satisfies { [x: string]: IEndpointMeta; }; +/** + * JSON Schema規格に沿った形でreq/resのスキーマを取得する + * + * 全てundefinedであればnullが返る + * 複数の定義がある場合はoneOfで返される + */ export function getEndpointSchema(reqres: 'req' | 'res', key: keyof typeof endpoints) { const endpoint = endpoints[key]; const schemas = endpoint.defines.map(d => d[reqres]).filter(d => d !== undefined);