What Standard Schema community packages would you like to see? #1
Replies: 1 comment
|
I’d love to see a Standard Schema HTTP error/response adapter that provides a consistent way to turn validation results into framework-independent API errors.
Standard Schema makes validation portable, but the moment validation fails, applications still have to decide how to translate In a backend API, I usually need to turn something like: {
issues: [
{ message: "Invalid email", path: ["email"] },
{ message: "Required", path: ["profile", "name"] }
]
}into a predictable API error format. Today this logic tends to be implemented separately in NestJS, Fastify, Express, Hono, routers, and application-specific error handlers. There are also subtle interoperability problems around A small official package could normalize Standard Schema failures into a stable, JSON-safe representation and provide framework adapters. For example: const result = await schema["~standard"].validate(input);
if (result.issues) {
throw new StandardHttpValidationError(result.issues);
}and then: {
status: 400,
code: "VALIDATION_ERROR",
issues: [
{
path: ["email"],
message: "Invalid email"
}
]
}The important part would be keeping the core representation framework-independent while providing optional adapters for HTTP frameworks.
Primarily:
The core package should not depend on any framework. 3. Existing alternatives / related work
There are also framework-specific implementations and integrations, such as React Hook Form's Standard Schema resolver, while projects like NestJS and TanStack Router have their own handling for validation issues. What seems to be missing is a small, framework-agnostic layer focused specifically on the transport boundary: Standard Schema validation result → safe, normalized API error This could also define utilities for safely normalizing 4. ContributionI’d be interested in helping design and build it. I work mostly with TypeScript backend APIs and deal with request validation, DTOs, HTTP error handling, NestJS/Fastify, and API documentation, so this is a problem I could realistically help implement and test across multiple frameworks. A good initial scope could be intentionally small:
|
Uh oh!
There was an error while loading. Please reload this page.
Standard Schema Community currently maintains:
We’d love your input on what would make the Standard Schema ecosystem more useful.
What package, integration, adapter, tooling, example, or documentation project would you like to see added here?
When suggesting an idea, please include:
A few directions we’re curious about:
No idea is too small—practical pain points are especially useful. We’ll collect the feedback and turn the strongest proposals into scoped issues or repositories.
All reactions