Skip to content

feat: support x-pattern-message extension in Zod and Valibot validator plugins - #4117

Merged
mrlubos merged 2 commits into
mainfrom
pullfrog/4116-x-pattern-message
Jun 21, 2026
Merged

mrlubos merged 2 commits into
mainfrom
pullfrog/4116-x-pattern-message

Conversation

@pullfrog

@pullfrog pullfrog Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Closes #4116

Adds support for the x-pattern-message OpenAPI extension in validator plugins. When a string schema has both a pattern and x-pattern-message, the message is passed as the second argument to .regex() / v.regex() calls.

Changes:

  • Zod v3 patternNode: reads x-pattern-message and passes as second arg to .regex()
  • Zod v4 patternNode: same
  • Zod mini patternNode: same (via .check(z.regex(pattern, message)))
  • Valibot patternNode: same (via v.regex(pattern, message))
  • Test fixture specs/3.0.x/validators.json: added x-pattern-message to an existing pattern-bearing schema
  • Updated all 7 snapshot files across zod v3, zod v4, and valibot test projects

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pullfrog
pullfrog Bot requested a review from mrlubos June 21, 2026 14:17
@changeset-bot

changeset-bot Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3ed3afb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 21, 2026 8:40pm

Request Review

@mrlubos
mrlubos force-pushed the pullfrog/4116-x-pattern-message branch from 4ebd3a4 to 3ed3afb Compare June 21, 2026 20:37
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.99%. Comparing base (ee11962) to head (3ed3afb).

Files with missing lines Patch % Lines
...penapi-ts/src/plugins/valibot/shared/extensions.ts 0.00% 3 Missing and 1 partial ⚠️
...es/openapi-ts/src/plugins/zod/shared/extensions.ts 0.00% 3 Missing and 1 partial ⚠️
.../openapi-ts/src/plugins/valibot/v1/toAst/string.ts 0.00% 3 Missing ⚠️
...es/openapi-ts/src/plugins/zod/mini/toAst/string.ts 0.00% 3 Missing ⚠️
...ages/openapi-ts/src/plugins/zod/v3/toAst/string.ts 0.00% 3 Missing ⚠️
...ages/openapi-ts/src/plugins/zod/v4/toAst/string.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4117      +/-   ##
==========================================
- Coverage   37.02%   36.99%   -0.03%     
==========================================
  Files         676      678       +2     
  Lines       23827    23843      +16     
  Branches     7143     7149       +6     
==========================================
  Hits         8821     8821              
- Misses      12070    12084      +14     
- Partials     2936     2938       +2     
Flag Coverage Δ
unittests 36.99% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Jun 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@hey-api/codegen-core

npm i https://pkg.pr.new/@hey-api/codegen-core@4117

@hey-api/json-schema-ref-parser

npm i https://pkg.pr.new/@hey-api/json-schema-ref-parser@4117

@hey-api/nuxt

npm i https://pkg.pr.new/@hey-api/nuxt@4117

@hey-api/openapi-python

npm i https://pkg.pr.new/@hey-api/openapi-python@4117

@hey-api/openapi-ts

npm i https://pkg.pr.new/@hey-api/openapi-ts@4117

@hey-api/shared

npm i https://pkg.pr.new/@hey-api/shared@4117

@hey-api/spec-types

npm i https://pkg.pr.new/@hey-api/spec-types@4117

@hey-api/types

npm i https://pkg.pr.new/@hey-api/types@4117

@hey-api/vite-plugin

npm i https://pkg.pr.new/@hey-api/vite-plugin@4117

commit: 3ed3afb

@mrlubos
mrlubos merged commit df4c37a into main Jun 21, 2026
10 of 12 checks passed
@mrlubos
mrlubos deleted the pullfrog/4116-x-pattern-message branch June 21, 2026 20:44
@hey-api hey-api Bot mentioned this pull request Jun 21, 2026

This branch was successfully deployed

1 active deployment
Preview — 3ed3afbe Deployed Jun 21, 2026 by vercel[bot]
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.

Support x-pattern-message extension for regular expressions

1 participant