Vana SDK - v2.2.2
    Preparing search index...

    Interface ValidationResult

    Validation result for data integrity checks and schema validation.

    Provides detailed feedback about validation outcomes, distinguishing between errors (which prevent processing) and warnings (which indicate potential issues). Used throughout the SDK for validating permissions, file formats, schemas, and API parameters before operations.

    // Validating user input
    function validateFileUpload(file: File): ValidationResult {
    const errors: string[] = [];
    const warnings: string[] = [];

    // Check file size
    if (file.size > 100 * 1024 * 1024) {
    errors.push('File size exceeds 100MB limit');
    } else if (file.size > 50 * 1024 * 1024) {
    warnings.push('Large file may take time to upload');
    }

    // Check file type
    if (!file.type.startsWith('image/')) {
    errors.push('Only image files are allowed');
    }

    return {
    valid: errors.length === 0,
    errors,
    warnings
    };
    }

    // Using validation result
    const result = validateFileUpload(file);
    if (!result.valid) {
    console.error('Validation failed:', result.errors.join(', '));
    } else {
    if (result.warnings.length > 0) {
    console.warn('Warnings:', result.warnings.join(', '));
    }
    // Proceed with upload
    }
    interface ValidationResult {
        valid: boolean;
        errors: string[];
        warnings: string[];
    }
    Index

    Properties

    Properties

    valid: boolean

    Whether validation passed

    errors: string[]

    Validation errors

    warnings: string[]

    Validation warnings