-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
z.looseEnum() for more permissive enum validation #4362
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
Comments
It would be nice if there was a way to define a schema with the inferred type |
Hello @colinhacks, I would like to work on this issue and create this function. |
@Lavdewangan1 maybe you should work in v4 branch? |
@marco-carvalho I am a bit unfamiliar with the v4 codebase can you please tell me the files and directories I've to add in the codebase in order to implement this feature correctly, it will be really helpfull if you can. |
@Lavdewangan1 I'm just as unfamiliar with the v4 codebase as you are 😅 |
Would it be possible to introduce a
z.looseEnum()
that functions likez.enum()
, but with more forgiving input validation? In my current workflow, I follow a request/model/response schema pattern. While models and responses are strictly typed, I want my request objects to be more permissive. Currently, I work around this by doing something like:A dedicated
z.looseEnum()
could allow unknown values through in request schemas.Examples:
Request:
Model:
Response:
The text was updated successfully, but these errors were encountered: