Skip to content

docs: clarify that validation.ts helpers are test utilities, not production utilities #14

@shwetank-dev

Description

@shwetank-dev

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions