Registers the Validator service (singleton) in the container, aliased as
validator/Validator, so middleware, handlers and services can resolve it.
It also binds whatever schema engines the application declared under
stone.validation.engines, so a schema class can take its engine through its constructor:
constructor ({ zod }). That is more elegant than importing the library at every schema, and more
testable, since a test hands the class a fake instead of mocking a module.
The application names the engine; this module never imports one. That is what keeps it agnostic:
Zod, Valibot and ArkType arrive through Standard Schema, and a native schema needs no engine at all.
Registers the Validator service (singleton) in the container, aliased as
validator/Validator, so middleware, handlers and services can resolve it.It also binds whatever schema engines the application declared under
stone.validation.engines, so a schema class can take its engine through its constructor:constructor ({ zod }). That is more elegant than importing the library at every schema, and more testable, since a test hands the class a fake instead of mocking a module.The application names the engine; this module never imports one. That is what keeps it agnostic: Zod, Valibot and ArkType arrive through Standard Schema, and a native schema needs no engine at all.