Interface IOpenApiOptions

Configuration options for OpenAPI support in Febby.

Example

const authMiddleware = { name: 'authMiddleware', func: (req,res,next)=>next()}
const userController = { name: 'userController', func: (req,res)=> res.send('userController')}
const openApiOptions: IOpenApiOptions = {
middlewares: [authMiddleware],
controllers: [userController],
openApiValidatorOptions: {
validateApiSpec: true,
validateResponses: true,
validateRequests: true
}
};

Hierarchy

  • IOpenApiOptions

Properties

controllers: string | IController[]

An array of controller functions to apply or provide controllers directory path

finalErrorHandler?: Handler

finalErrorHandler will be configured after routes registered so you can customize errors and response structure. default to below handler

Example

router.use((err, req, res, next) => {
res.status(err.status || 500).json({
message: err.message,
errors: err.errors,
});
});
middlewares: string | IMiddleware[]

An array of middleware functions to apply or provide middlewares directory path

openApiValidatorOptions: IOpenApiValidatorOptions

Options for OpenAPI validation.

Generated using TypeDoc