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

feat(zod): add option coerce #1310

Merged
merged 1 commit into from
Apr 15, 2024
Merged

Conversation

anymaniax
Copy link
Collaborator

Status

READY

Description

Add option coerce to zod client

@anymaniax anymaniax merged commit 25267ae into master Apr 15, 2024
2 checks passed
@anymaniax anymaniax deleted the feature/zod-add-option-coerce branch April 15, 2024 21:38
@melloware melloware added this to the 6.28.0 milestone Apr 15, 2024
@melloware melloware added the zod Zod related issue label Apr 15, 2024
@soartec-lab
Copy link
Member

@anymaniax @melloware

Although it is an undocumented specification, it is actually possible to configure it so that coerce is used even when the coerceTypes option is specified.

https://github.com/anymaniax/orval/blob/master/packages/zod/src/index.ts#L327-L329

However, you cannot specify parameters and it will apply to all objects. I think the options supported this time are good because they can be set in more detail.
From an overall perspective, there are multiple options with the same settings, so I would like to unify them. My suggestion is to deprecate coerceTypes and remove it in the next two versions, what do you think?

@anymaniax
Copy link
Collaborator Author

@soartec-lab I already added the deprecated warning on coerceTypes. if you use it or in the documentation directly

@soartec-lab
Copy link
Member

soartec-lab commented Apr 16, 2024

@anymaniax
Oops, you already deprecated it on this PR. I'm careful to remove it in the next two versions or later.

@soartec-lab soartec-lab added the enhancement New feature or request label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request zod Zod related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants