Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Pass through value failure #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

ismcodes
Copy link

When validation fails, pass through the original value argument. Runtypes does give the message and key for the validation failure, however it does not (currently) pass through the original value argument, so there is not any introspection that can be done on it after failure without the original un-validated value. This is annoying because if one wants to do introspection after failure (e.g. null check) it would have to be done by passing in the runtype Result and the original any/unknown value.

It would be dangerous to allow Success and Failure to both have a value key because then one could call .value on any type of result. IMO calling it valueInvalidated indicates that it does represent some sort of value but it should not be taken as checked data.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant