Use Standard Schema validator instead of separate ones
Standard Schema provides a unified way to work with different validator libraries. Many libraries already support it. We have Standard Schema validator in this honojs/middleware repo.
With Standard Schema Validator, we may no longer rely on individual validators:
Issue #1235 specifically concerns ArkType validator, but by focusing on Standard Schema Validator, we can avoid handling such individual cases. We also won't need to add support for new validators when they appear.
I've been aware of the benefits of Standard Schema, but I was hesitant to commit to it fully. Now, I believe it's time to deprecate the separate validators and encourage the use of Standard Schema validator.
This proposal is based on the comment by @MonsterDeveloper.
Please share any concerns you have about using Standard Schema validator. Otherwise, let's move forward!
cc: Authors of each validator
@MonsterDeveloper @gunta @ZerNico @muningis
Thank you! Exactly what I was thinking about.
As for arktype-validator, the only custom logic piece apart from the validation itself is stripping out sensitive fields from the error return value (i.e. cookies header), implemented as per #1135
Preliminary digging shows, that custom logic can be easily implemented by checking the schema['~standard'].vendor === "arktype":
console.log(schema['~standard']);
// Output
{
vendor: "arktype",
version: 1,
validate: [Function: validate],
}
I can add a PR for the standard schema validator for seamless migration.