-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Strip checks and effects #3547
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given a schema with many checks and/or effects, I need to be able to parse an object without using any of the checks or effects. Take the following contrived schema
The schema is defined, I don't want to re-write it. I don't want to have to declare a base schema without checks/effects and extend it with checks/effects. I want to strip the checks and effects so that the resulting schema looks like this
I've tried doing this manually, but I can't strip the checks and effects without modifying the original schema. I would have to be able to deep clone the schema. My hacky attempt looks like this
While this does successfully strip the checks and effects, the input schema is also modified. Hence the need for a deep clone method. Alternatively, it would be even better if, similar to
.deepPartial
, there were methods like.stripEffects
and.stripChecks
that could provide this functionality.My particular use case is letting me validate unkown json to set default form data. As long as the unkown json is in the correct shape, the validation would pass and the form populated. The more important and complex validation wouldn't occur until the form is submitted.
The text was updated successfully, but these errors were encountered: