UNPKG

joiful

Version:

TypeScript Declarative Validation. Decorate your class properties to validate them using Joi.

53 lines (52 loc) 1.81 kB
import * as Joi from 'joi'; import { TypedPropertyDecorator } from '../core'; import { ModifierProviders, JoifulOptions } from './common'; import { AnySchemaModifiers } from './any'; export interface NumberSchemaModifiers extends AnySchemaModifiers { /** * Specifies that the value must be greater than limit. * @param limit The amount that the value must be greater than. */ greater(limit: number): this; /** * Requires the number to be an integer (no floating point). */ integer(): this; /** * Specifies that the value must be less than limit. * @param limit The amount that the value must be less than. */ less(limit: number): this; /** * Specifies the maximum value. * @param limit The maximum value. */ max(limit: number): this; /** * Specifies the minimum value. * @param limit The minimum value. */ min(limit: number): this; /** * Specifies that a value must be a multiple of base. * @param base */ multiple(base: number): this; /** * Requires the number to be negative. */ negative(): this; /** * Requires the number to be positive. */ positive(): this; /** * Specifies the maximum number of decimal places. * @param limit The maximum number of decimal places allowed. */ precision(limit: number): this; } export declare function getNumberSchemaModifierProviders(getJoi: () => typeof Joi): ModifierProviders<Joi.NumberSchema, NumberSchemaModifiers>; export interface NumberSchemaDecorator extends NumberSchemaModifiers, TypedPropertyDecorator<number> { } export declare const createNumberPropertyDecorator: (joifulOptions: JoifulOptions) => import("./common").PropertyDecorator<number, NumberSchemaModifiers>;