@fp8/simple-config
    Preparing search index...

    Interface ValidateModelOptions

    Options to be passed to .validateModel method. Extends ValidatorOptions from class-validator with additional disable option to skip validation.

    interface ValidateModelOptions {
        always?: boolean;
        disable?: boolean;
        dismissDefaultMessages?: boolean;
        enableDebugMessages?: boolean;
        forbidNonWhitelisted?: boolean;
        forbidUnknownValues?: boolean;
        groups?: string[];
        skipMissingProperties?: boolean;
        skipNullProperties?: boolean;
        skipUndefinedProperties?: boolean;
        stopAtFirstError?: boolean;
        strictGroups?: boolean;
        validationError?: { target?: boolean; value?: boolean };
        whitelist?: boolean;
    }

    Hierarchy

    • ValidatorOptions
      • ValidateModelOptions
    Index

    Properties

    always?: boolean

    Set default for always option of decorators. Default can be overridden in decorator options.

    disable?: boolean

    Depricated. Use disableValidation in EntityCreatorOptions instead.

    dismissDefaultMessages?: boolean

    If set to true, the validation will not use default messages. Error message always will be undefined if its not explicitly set.

    enableDebugMessages?: boolean

    If set to true then class-validator will print extra warning messages to the console when something is not right.

    forbidNonWhitelisted?: boolean

    If set to true, instead of stripping non-whitelisted properties validator will throw an error

    forbidUnknownValues?: boolean

    Fails validation for objects unknown to class-validator. Defaults to true.

    For instance, since a plain empty object has no annotations used for validation:

    • validate({}) // fails.
    • validate({}, { forbidUnknownValues: true }) // fails.
    • validate({}, { forbidUnknownValues: false }) // passes.
    • validate(new SomeAnnotatedEmptyClass(), { forbidUnknownValues: true }) // passes.
    groups?: string[]

    Groups to be used during validation of the object.

    skipMissingProperties?: boolean

    If set to true then validator will skip validation of all properties that are null or undefined in the validating object.

    skipNullProperties?: boolean

    If set to true then validator will skip validation of all properties that are null in the validating object.

    skipUndefinedProperties?: boolean

    If set to true then validator will skip validation of all properties that are undefined in the validating object.

    stopAtFirstError?: boolean

    When set to true, validation of the given property will stop after encountering the first error. Defaults to false.

    strictGroups?: boolean

    If [groups]ValidatorOptions#groups is not given or is empty, ignore decorators with at least one group.

    validationError?: { target?: boolean; value?: boolean }

    ValidationError special options.

    Type Declaration

    • Optionaltarget?: boolean

      Indicates if target should be exposed in ValidationError.

    • Optionalvalue?: boolean

      Indicates if validated value should be exposed in ValidationError.

    whitelist?: boolean

    If set to true validator will strip validated object of any properties that do not have any decorators.

    Tip: if no other decorator is suitable for your property use

    decorator.