mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-26 09:23:09 +02:00
wip
This commit is contained in:
parent
b14d3cdc32
commit
dfdfc8fab4
1 changed files with 6 additions and 0 deletions
|
@ -962,6 +962,12 @@ export const endpoints = {
|
||||||
},
|
},
|
||||||
} as const satisfies { [x: string]: IEndpointMeta; };
|
} as const satisfies { [x: string]: IEndpointMeta; };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON Schema規格に沿った形でreq/resのスキーマを取得する
|
||||||
|
*
|
||||||
|
* 全てundefinedであればnullが返る
|
||||||
|
* 複数の定義がある場合はoneOfで返される
|
||||||
|
*/
|
||||||
export function getEndpointSchema(reqres: 'req' | 'res', key: keyof typeof endpoints) {
|
export function getEndpointSchema(reqres: 'req' | 'res', key: keyof typeof endpoints) {
|
||||||
const endpoint = endpoints[key];
|
const endpoint = endpoints[key];
|
||||||
const schemas = endpoint.defines.map(d => d[reqres]).filter(d => d !== undefined);
|
const schemas = endpoint.defines.map(d => d[reqres]).filter(d => d !== undefined);
|
||||||
|
|
Loading…
Reference in a new issue