Summary
The validator subsystem is structurally cleaner after the schema and constraint-validator split, but it still carries technical debt in the typed constraint option boundary and in the schema normalization path.
Current debt
ConstraintContext still exposes options only as ConstraintOptions, so concrete constraints recover their real option shapes with casts instead of through the type system.
- Built-in constraint option types such as
NotBlankOptions, EmailOptions, and SlugOptions do not formally extend the shared global option contract, even though all constraints are expected to support those shared options.
create-validator.ts still restates part of the public schema DSL locally (FieldSchemaDeclaration) instead of depending on a single authoritative type representation.
- Schema normalization, group filtering, nested schema traversal, and unknown-constraint resolution are still concentrated in
create-validator.ts, which makes that file the main accumulation point for future design drag.
- The schema vocabulary has improved, but there is still some duplication in the declaration layer, for example
FieldSchemaMap = ConstraintSchema, which may indicate the type model is not fully settled yet.
- Import style across the validator subsystem is inconsistent between relative imports and
@/validator/..., which adds small but real friction in a relatively small module tree.
Affected files
src/validator/constraint.ts
src/validator/schema.ts
src/validator/constraint-validator.ts
src/validator/factory/create-validator.ts
src/validator/constraints/basic/not-blank.ts
src/validator/constraints/string/email.ts
src/validator/constraints/string/slug.ts
Why this matters
The public model says constraints support shared options plus constraint-specific options, but the implementation does not fully express that relationship in the type system yet. That leaves the most important validator contracts partially enforced by convention and local casts rather than by types.
Summary
The validator subsystem is structurally cleaner after the schema and constraint-validator split, but it still carries technical debt in the typed constraint option boundary and in the schema normalization path.
Current debt
ConstraintContextstill exposesoptionsonly asConstraintOptions, so concrete constraints recover their real option shapes with casts instead of through the type system.NotBlankOptions,EmailOptions, andSlugOptionsdo not formally extend the shared global option contract, even though all constraints are expected to support those shared options.create-validator.tsstill restates part of the public schema DSL locally (FieldSchemaDeclaration) instead of depending on a single authoritative type representation.create-validator.ts, which makes that file the main accumulation point for future design drag.FieldSchemaMap = ConstraintSchema, which may indicate the type model is not fully settled yet.@/validator/..., which adds small but real friction in a relatively small module tree.Affected files
src/validator/constraint.tssrc/validator/schema.tssrc/validator/constraint-validator.tssrc/validator/factory/create-validator.tssrc/validator/constraints/basic/not-blank.tssrc/validator/constraints/string/email.tssrc/validator/constraints/string/slug.tsWhy this matters
The public model says constraints support shared options plus constraint-specific options, but the implementation does not fully express that relationship in the type system yet. That leaves the most important validator contracts partially enforced by convention and local casts rather than by types.