This commit is contained in:
tamaina 2023-05-26 07:53:19 +00:00
parent b14d3cdc32
commit dfdfc8fab4

View file

@ -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);