UNPKG

@dvsa/appdev-api-common

Version:

Utils library for common API functionality

14 lines (13 loc) 655 B
interface ValidateRequestBodyOptions { isArray?: boolean; errorDetails?: boolean; } /** * Decorator tp validate an express request body against a specified schema * @param {object} schema - the json schema you wish to use as the validator * @param {ValidateRequestBodyOptions} opts * - isArray: whether the body is expected to be an array * - errorDetails: whether to return detailed error messages (Note: errors are logged regardless of this setting) */ export declare function ValidateRequestBody<T>(schema: object, opts?: ValidateRequestBodyOptions): (_target: T, _propertyKey: string, descriptor: PropertyDescriptor) => void; export {};