Skip to content

Add base64 support for zod #2267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ligazetom
Copy link

Hey, take this as a bit more elaborate feature request as I have no idea what I'm doing really.

This PR should generate .base64() constraint if format: byte. If it doesn't, then I think it should :D

Currently I'm doing some post processing on generated zod file to add base64() constraint as well as trim().

I have no idea if trim() could be somehow implemented, but I believe no one really considers whitechars valid, so can it be done at least with some flag maybe?

Let me know if 'implementation' is not total garbage and I'll adjust tests as well, I just don't have really time to spare on these things if the PR maybe won't get even looked at.

Copy link

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

Copy link

changeset-bot bot commented Jul 3, 2025

⚠️ No Changeset found

Latest commit: a021f0d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

vercel bot commented Jul 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hey-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2025 11:30am

Copy link

pkg-pr-new bot commented Jul 3, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2267
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2267
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2267

commit: a021f0d

Copy link

codecov bot commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 24.79%. Comparing base (7884190) to head (a021f0d).

Files with missing lines Patch % Lines
packages/openapi-ts/src/plugins/zod/plugin.ts 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2267      +/-   ##
==========================================
- Coverage   24.80%   24.79%   -0.01%     
==========================================
  Files         299      299              
  Lines       28297    28305       +8     
  Branches     1276     1276              
==========================================
  Hits         7018     7018              
- Misses      21270    21278       +8     
  Partials        9        9              
Flag Coverage Δ
unittests 24.79% <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.

@mrlubos
Copy link
Member

mrlubos commented Jul 3, 2025

@ligazetom I'll say go for it, simply because there's no conflicting implementation and you're the first one to request this format. You just need to run pnpm openapi-ts-tests test:update to update snapshots. You'll need to build individual packages if anything fails (openapi-ts, config-vite-base, etc). Thanks for adding this!

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.

2 participants