How acmepy/yep works
Yep is a small asynchronous JavaScript validation library. An application builds a field or object schema through the public yep API, configures types and chainable rules, then validates data; object validation returns validated values or errors, with an optional safe summary. The library also converts between Yep schemas and a documented subset of JSON Schema, and supports custom types and tests. The map follows sampled entry-point and field-validation code; some object-schema and rule wiring is included only where README capabilities and the source tree support it.
Main entry points: index.js Yep API · object-schema.js Object Schema · base-type.js Field Validation · from-json-schema.js JSON Schema Import
Components 16
Schema API
- Yep API
src/index.js - Object Schema
src/core/object-schema.js - Field Schema
src/core/base-type.js - Built-in Types
src/types - Date Normalization
src/types/date.js
Validation
- Built-in Rules
src/tests - Field Validation
src/core/base-type.js - Object Validation
src/core/object-schema.js - Error Messages
src/errors/messages.js - Validation Error
src/errors/validation-error.js
Extensibility
- Rule Registry
src/core/registry.js - Custom Rules
src/tests/custom.js
Schema Conversion
- JSON Schema Import
src/json-schema/from-json-schema.js - JSON Schema Export
src/json-schema/to-json-schema.js
Other components
- Application
- Application Validator
Connections 20
- Application → Yep API: configures and validates
- Yep API → Object Schema: creates
- Yep API → Built-in Types: creates types
- Yep API → Rule Registry: registers extensions
- Object Schema → Field Schema: defines fields
- Object Schema → Object Validation: validates object
- Field Schema → Field Validation: validates field
- Field Schema → Date Normalization: normalizes dates
- Field Validation → Built-in Rules: runs rules
- Field Validation → Error Messages: formats errors
- Field Validation → Validation Error: throws
- Object Validation → Field Validation: validates fields
- Object Validation → Validation Error: aggregates errors
- Rule Registry → Custom Rules: registers
- Custom Rules → Application Validator: invokes callback
- Field Schema → JSON Schema Export: exports schema
- Object Schema → JSON Schema Export: exports schema
- Yep API → JSON Schema Import: imports schema
- JSON Schema Import → Object Schema: creates object schema
- JSON Schema Import → Built-in Types: creates field types