@vinejs/vine - v4.2.0
    Preparing search index...

    Class VineAny

    VineAny represents a schema type that accepts any value without validation. It allows strings, numbers, booleans, arrays, objects, and any other type. Use this when you want to accept any input but still want to apply custom validations.

    const schema = vine.any()

    const result = await vine.validate({
    schema,
    data: 'any value, including objects and arrays'
    })

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    "[SUBTYPE]": string = 'any'

    The subtype identifier for the literal schema field

    "[ITYPE]": any

    Define the input type of the schema for TypeScript inference

    "[OTYPE]": any

    The output value type of the field after validation. The property points to a type only and not the real value.

    "[COTYPE]": any

    Type marker for camelCase output type inference

    dataTypeValidator?: Validation<any>

    The validation to use for validating the schema data type. Using a data type validator guards custom rules to only run when the data type validation passes.

    class StringSchema extends BaseLiteralType {
    dataTypeValidator = stringDataTypeRule
    }
    options: FieldOptions

    Configuration options for this field including bail mode, nullability, and parsing

    Methods

    • Clones the VineAny schema type. The applied options and validations are copied to the new instance.

      Returns this

      A cloned instance of this VineAny schema

    • Define a method to parse the input value. The method is invoked before any validation and hence you must perform type-checking to know the value you are working it.

      Parameters

      • callback: ParseFn

      Returns this

    • Adds a validation rule to the schema's validation chain. Rules are executed in the order they are added.

      Parameters

      Returns this

      This schema instance for method chaining

      vine.string().use(minLength({ length: 3 }))
      vine.number().use(customRule({ strict: true }))
    • Enable/disable bail mode for this field. In bail mode, field validations stop after the first error.

      Parameters

      • state: boolean

        Whether to enable bail mode

      Returns VineAny

      This schema instance for method chaining

      vine.string().bail(false) // Continue validation after first error
      vine.number().bail(true) // Stop after first error (default)
    • Compiles the literal schema type into a compiler node. This method transforms the schema definition into a format that the validation compiler can process.

      Parameters

      • propertyName: string

        Name of the property being compiled

      • refs: RefsStore

        Reference store for the compiler

      • options: ParserOptions

        Parser options including camelCase conversion

      Returns FieldNode & {} & { subtype: string }

      Compiled literal node with subtype information