Skip to content

fix: generate v.null() for type: "null" schemas in valibot#16

Merged
maxholman merged 1 commit intoblock65:masterfrom
maxholman:fix/valibot-type-null
Apr 9, 2026
Merged

fix: generate v.null() for type: "null" schemas in valibot#16
maxholman merged 1 commit intoblock65:masterfrom
maxholman:fix/valibot-type-null

Conversation

@maxholman
Copy link
Copy Markdown
Contributor

Summary

  • type: "null" (OAS 3.1 / JSON Schema 2020-12) now generates v.null() instead of v.unknown()
  • Fixes oneOf: [{ type: "string" }, { type: "null" }] pattern generating v.union([v.string(), v.unknown()]) instead of v.union([v.string(), v.null()])

Test plan

  • New test: oneOf with type null generates v.null()
  • All 9 tests pass

🤖 Generated with Claude Code

Previously type: "null" (valid in OAS 3.1 / JSON Schema 2020-12) fell
through to v.unknown(). Common in oneOf patterns like
oneOf: [{ type: "string" }, { type: "null" }] for nullable fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@maxholman maxholman merged commit f6ad2cc into block65:master Apr 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant