Skip to content
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

Helper: how to converse file type? #101

Closed
caoxing9 opened this issue Dec 20, 2023 · 2 comments
Closed

Helper: how to converse file type? #101

caoxing9 opened this issue Dec 20, 2023 · 2 comments

Comments

@caoxing9
Copy link

I have a binary file field
i use z.string() to express
so i get the json is that

{
  type: 'object',
  properties: { file: {type: string} },
  required: [ 'file' ],
  additionalProperties: false
}

but i expect to get with format: binary like this, what can i do for it?

{
  type: 'object',
  properties: { file: {type: string, format: binary} },
  required: [ 'file' ],
  additionalProperties: false
}
@StefanTerdell
Copy link
Owner

Hello! There is currently no way to tell Zod that a string contains binary, so there's nothing I can do.

However, I have opened a PR for base64 validation in Zod exactly due to this issue.

colinhacks/zod#3047

Closing this as a duplicate of #95

@caoxing9
Copy link
Author

Hello! There is currently no way to tell Zod that a string contains binary, so there's nothing I can do.

However, I have opened a PR for base64 validation in Zod exactly due to this issue.

colinhacks/zod#3047

Closing this as a duplicate of #95

thanks for replying, looking forward...

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

No branches or pull requests

2 participants