@vinejs/vine - v4.0.0-next.1
    Preparing search index...

    Class VineCamelCaseObject<Schema>

    Converts schema properties to camelCase during validation. This is a wrapper around VineObject that automatically converts property names from snake_case to camelCase in the output.

    const schema = vine.object({
    first_name: vine.string(),
    last_name: vine.string()
    }).camelCase()

    // Output will have: { firstName: string, lastName: string }

    Type Parameters

    • Schema extends VineObject<any, any, any, any>

      The underlying VineObject schema type

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    "[ITYPE]": Schema[typeof ITYPE]

    Define the input type of the schema for TypeScript inference

    "[OTYPE]": Schema[typeof COTYPE]

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

    "[COTYPE]": Schema[typeof COTYPE]

    Type marker for camelCase output type inference

    "[UNIQUE_NAME]": string = 'types.object'

    Unique name identifier for union type resolution

    Methods

    • 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 with.

      Parameters

      • callback: ParseFn

        Parser function to transform the input value

      Returns this

      This schema instance for method chaining

      vine.string().parse((value) => {
      return typeof value === 'string' ? value.trim() : value
      })
    • Type checker function to determine if a value is an object. Required for "unionOfTypes" functionality.

      Parameters

      • value: unknown

        The value to check

      Returns boolean

      True if the value is a non-null object and not an array

    • Compiles the schema type to a compiler node with camelCase enabled.

      Parameters

      • propertyName: string

        Name of the property being compiled

      • refs: RefsStore

        Reference store for the compiler

      • options: ParserOptions

        Parser options

      Returns ObjectNode

      Compiled object node with camelCase conversion