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

    Interface ConstructableSchema<Inputs, Output, CamelCaseOutput>

    Base interface for all constructable schema types in Vine. Defines the contract that all schema types must implement for type inference, compilation, and validation.

    class StringSchema implements ConstructableSchema<string | undefined, string, string> {
    [ITYPE]: string | undefined
    [OTYPE]: string
    [COTYPE]: string

    [PARSE](propertyName: string, refs: RefsStore, options: ParserOptions) {
    return { type: 'literal', subtype: 'string' }
    }

    clone() { return new StringSchema() }
    }
    interface ConstructableSchema<Inputs, Output, CamelCaseOutput> {
        "[ITYPE]": Inputs;
        "[OTYPE]": Output;
        "[COTYPE]": CamelCaseOutput;
        "[PARSE]"(
            propertyName: string,
            refs: RefsStore,
            options: ParserOptions,
        ): CompilerNodes;
        clone(): this;
        "[UNIQUE_NAME]"?: string;
        "[IS_OF_TYPE]"?: (value: unknown, field: FieldContext) => boolean;
    }

    Type Parameters

    • Inputs

      The expected input type before validation

    • Output

      The validated output type

    • CamelCaseOutput

      The output type with camelCase field names

    Implemented by

    Index

    Properties

    "[ITYPE]": Inputs

    Type marker for input type inference

    "[OTYPE]": Output

    Type marker for output type inference

    "[COTYPE]": CamelCaseOutput

    Type marker for camelCase output type inference

    "[UNIQUE_NAME]"?: string

    Unique identifier for the schema type. Implement if you want schema type to be used with unionOfTypes.

    "[IS_OF_TYPE]"?: (value: unknown, field: FieldContext) => boolean

    Type checking function for union type resolution

    Methods

    • Creates a deep copy of the schema instance

      Returns this