How vinejs/vine works
VineJS is a Node.js form-data validation library. A caller defines a schema through the Vine API and schema builder, compiles it, then validates input; the validator applies compiled field rules and returns validated data or reports structured validation errors. The tree documents broad schema coverage, including primitives, collections, unions, enums, dates, files, and optional/conditional behavior. The graph groups related schema implementations for clarity. Most runtime links are supported by the source index or excerpts; unsampled implementation details are not inferred.
Main entry points: builder.ts Schema builder · vine/main.ts Vine API · validator.ts Validation engine · string/main.ts Primitive schemas
Components 17
Public API and execution
- Vine API
src/vine/main.ts - Schema builder
src/schema/builder.ts - Validation engine
src/vine/validator.ts
Schema definitions
- Primitive schemas
src/schema/string/main.ts - Number and date schemas
src/schema/number/main.ts - Object and collection schemas
src/schema/object/main.ts - Variants and special schemas
src/schema/union/main.ts - Optional schema
src/schema/optional/main.ts
Rules and shared logic
- Base schema behavior
src/schema/base/main.ts - Literal schema behavior
src/schema/base/literal.ts - Rule construction
src/vine/create_rule.ts - Validation helpers
src/vine/helpers.ts
Validation feedback
- Default messages
src/defaults.ts - Message provider
src/messages_provider/simple_messages_provider.ts - Error reporter
src/reporters/simple_error_reporter.ts - Validation error
src/errors/validation_error.ts
Other components
- Application caller
Connections 20
- Application caller → Vine API: uses
- Vine API → Validation engine: compiles schema
src/vine/main.ts - Vine API → Schema builder: creates schemas
src/vine/main.ts - Vine API → Message provider: configures
src/vine/main.ts - Vine API → Error reporter: configures
src/vine/main.ts - Schema builder → Primitive schemas: builds
src/schema/builder.ts - Schema builder → Number and date schemas: builds
src/schema/builder.ts - Schema builder → Object and collection schemas: builds
src/schema/builder.ts - Schema builder → Variants and special schemas: builds
src/schema/builder.ts - Schema builder → Optional schema: builds
src/schema/builder.ts - Primitive schemas → Literal schema behavior: extends
src/schema/string/main.ts - Number and date schemas → Literal schema behavior: uses
src/schema/number/main.ts - Object and collection schemas → Base schema behavior: uses
src/schema/object/main.ts - Optional schema → Base schema behavior: uses
src/schema/optional/main.ts - Primitive schemas → Rule construction: registers rules
src/schema/string/main.ts - Number and date schemas → Validation helpers: uses
src/schema/number/main.ts - Validation engine → Default messages: loads defaults
src/vine/validator.ts - Message provider → Default messages: uses defaults
- Validation engine → Error reporter: reports failures
- Error reporter → Validation error: creates error
src/reporters/simple_error_reporter.ts