Skip to content

fix(zod): support guid format in Zod v4/mini#3552

Merged
mrlubos merged 9 commits intohey-api:mainfrom
erikwski:main
Mar 12, 2026
Merged

fix(zod): support guid format in Zod v4/mini#3552
mrlubos merged 9 commits intohey-api:mainfrom
erikwski:main

Conversation

@erikwski
Copy link
Contributor

fix(zod): support guid format in Zod v4/mini and add regression coverage

First Contribution Note

This is my first contribution to this project.

I am not fully sure whether external contributions are currently accepted, but I prepared this PR following the repository contribution guidance and test workflow.

Summary

This PR fixes GUID format handling in the Zod plugin for compatibility versions 4 and mini.

Before this change, OpenAPI schemas using:

schema:
  type: string
  format: guid

were generated as a plain string in Zod v4 output.

After this change:

  • Zod v4 output generates z.guid()
  • Zod Mini output generates z.guid()
  • Zod v3 behavior remains unchanged (z.string())

What Changed

  • Added guid identifier in Zod constants.
  • Added format: guid mapping in:
    • Zod v4 string AST conversion
    • Zod Mini string AST conversion
  • Added regression fixture and test scenario for GUID format.
  • Updated snapshots for v3/v4/mini outputs.
  • Updated fixture parameter naming from cdoId to guidId.

Validation

Executed:

pnpm tt -- @test/openapi-ts-zod-v4 --update

Result:

  • 4 test files passed
  • 93 tests passed
  • snapshots updated and verified

Notes

  • This PR is intentionally scoped to a single behavior fix in Zod string format handling.
  • No changes to public plugin configuration API were introduced.

@bolt-new-by-stackblitz
Copy link

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

@pullfrog
Copy link

pullfrog bot commented Mar 11, 2026

Error

agent completed without reporting progress

Pullfrog  | Rerun failed job ➔View workflow run | Triggered by Pullfrogpullfrog.com𝕏

@vercel
Copy link

vercel bot commented Mar 11, 2026

@erikwski is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link

changeset-bot bot commented Mar 11, 2026

🦋 Changeset detected

Latest commit: 08d9909

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

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug 🔥 Broken or incorrect behavior. labels Mar 11, 2026
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.09%. Comparing base (44ce085) to head (08d9909).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...es/openapi-ts/src/plugins/zod/mini/toAst/string.ts 0.00% 2 Missing ⚠️
...ages/openapi-ts/src/plugins/zod/v4/toAst/string.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3552      +/-   ##
==========================================
- Coverage   39.10%   39.09%   -0.01%     
==========================================
  Files         493      493              
  Lines       18368    18372       +4     
  Branches     5444     5452       +8     
==========================================
  Hits         7183     7183              
- Misses       9028     9032       +4     
  Partials     2157     2157              
Flag Coverage Δ
unittests 39.09% <0.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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
Copy link

pkg-pr-new bot commented Mar 11, 2026

Open in StackBlitz

@hey-api/codegen-core

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

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

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

@hey-api/nuxt

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

@hey-api/openapi-ts

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

@hey-api/shared

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

@hey-api/types

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

@hey-api/vite-plugin

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

commit: 618b3ac

Copy link
Member

@mrlubos mrlubos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikwski looks good, thank you!

Copy link
Member

@mrlubos mrlubos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great, thank you!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 12, 2026
@mrlubos mrlubos merged commit 0a9bb68 into hey-api:main Mar 12, 2026
7 of 10 checks passed
@hey-api hey-api bot mentioned this pull request Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔥 Broken or incorrect behavior. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants