-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Summary
The validate* helper functions in packages/schemas/src/validation.ts (e.g. validateBundleSearchResponse, validateSkillDetail, validateBundleDetail, etc.) are named like production runtime utilities but are only used in tests (packages/schemas/tests/validation.test.ts). Production consumers handle validation differently:
| Consumer | How it handles validation |
|---|---|
| Registry | Fastify serializes and validates responses via toJsonSchema() |
| SDK | Relies on the server-side Fastify guarantee, uses type casts |
| CLI | Calls schema.safeParse() directly where needed |
| Web | Relies on the server-side Fastify guarantee, uses type casts |
Problem
A new contributor reading validation.ts would reasonably assume these helpers are meant to be wired into the SDK or web client for runtime response validation, and could waste time submitting a PR that adds them where they don't belong.
Suggested fix
Add a short doc comment at the top of validation.ts clarifying intent:
/**
* Typed validation helpers wrapping Zod's safeParse.
*
* These are used in tests only. Production consumers handle validation
* differently:
* - Registry: Fastify serializes and validates responses via toJsonSchema()
* - SDK: relies on the server-side guarantee, uses type casts
* - CLI: calls schema.safeParse() directly where needed
* - Web: relies on the server-side guarantee, uses type casts
*/Issue raised with the help of Claude Code (claude-sonnet-4-6)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation