@sleekify/sleekify-fastify
Version:
A TypeScript decorator driven approach for developing Fastify web applications.
45 lines (44 loc) • 1.5 kB
TypeScript
import { type FastifyReply, type FastifyRequest } from 'fastify';
import { type OpenAPIObject } from '@sleekify/sleekify';
/**
* This class provides the Sleekify integration for Fastify.
*/
export declare class Sleekify {
private readonly classArray;
private readonly specification;
private serviceHandlers?;
private plugin?;
/**
* Creates a new Sleekify instance.
*
* @param specification The OpenAPI base specification
* @param classArray The resource classes to include in the OpenAPI specification
*/
constructor(specification: OpenAPIObject, classArray: any[]);
/**
* Get a Fastify plugin which you can register.
*/
getPlugin(): (fastify: any, options: any) => Promise<any>;
/**
* Get the OpenAPI specification which may be passed to Fastify OpenAPI glue.
* @param options The options
* @param options.pretty Sort the specification path's etc.
*/
getSpecification(options?: {
pretty?: boolean;
}): OpenAPIObject;
/**
* Get the service handlers which may be passed to Fastify OpenAPI glue.
*/
getServiceHandlers(): Record<string, (request: FastifyRequest, reply: FastifyReply) => Promise<any>>;
private initialize;
private addComponents;
private addPath;
private addRequestBody;
private addResponses;
private addSchemas;
private addServiceHandlers;
private getSuccessStatusCodes;
private sortObject;
private sortOperationObjects;
}