UNPKG

656 BTypeScriptView Raw
1/**
2 * Schemas in Fastify follow the JSON-Schema standard. For this reason
3 * we have opted to not ship strict schema based types. Instead we provide
4 * an example in our documentation on how to solve this problem. Check it
5 * out here:
6 */
7export interface FastifySchema {
8 body?: unknown;
9 querystring?: unknown;
10 params?: unknown;
11 headers?: unknown;
12 response?: unknown;
13}
14
15export interface FastifyRouteSchemaDef {
16 schema: FastifySchema;
17 method: string;
18 url: string;
19 httpPart?: string;
20 httpStatus?: string;
21}
22
23/**
24 * Compiler for FastifySchema Type
25 */
26export type FastifySchemaCompiler = (routeSchema: FastifyRouteSchemaDef) => unknown