feat: generate typed header parameters with valibot validation#13
Merged
maxholman merged 5 commits intoblock65:masterfrom Apr 9, 2026
Merged
feat: generate typed header parameters with valibot validation#13maxholman merged 5 commits intoblock65:masterfrom
maxholman merged 5 commits intoblock65:masterfrom
Conversation
Consumers need iterable enum values at runtime (e.g. for dropdown options) but TypeScript union types are erased. Generate an enums.ts file with `as const` arrays for each enum schema. Skip writing the file when no enums exist. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
type: ["string", "null"] (valid in OAS 3.1) fell through to v.unknown() because neither the type nor valibot codegen handled array-form types. const schemas were ignored in valibot output entirely, and only handled for strings in type generation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collect header params from operations and generate:
- Exported *Header type aliases with lowercase keys (HTTP/2 compliant)
- Non-strict v.object() valibot schemas allowing extra HTTP headers
- Integer/boolean types as native (not stringish) since valibot parses them
Header schemas are excluded from hono middleware (no c.req.valid("header")
support) but exported from valibot.ts for manual validation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
*Headertype aliases for operations within: "header"parameters, with lowercase keys (HTTP/2 compliant)v.object()valibot schemas for header validation, allowing extra HTTP headers to pass throughc.req.valid("header"))Test plan
v.object()(notv.strictObject())🤖 Generated with Claude Code