-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested
Description
Let's discuss new vaa api here.
Previously discussed:
- Make errors list of ErrorObj (Should we make it raisable?);
- Drop special types for validators in favor of functions and typing.NamedTuple. (done in New validators creation method #3)
I also suggest to:
- drop
is_validproperty and threat data as valid if no errors returned; - rename cleaned_data to data (cause it shorter) and just assume that is valid (still not sure about this).
New api example:
validator = vaa.get_from(some_scheme)
some_data = {'a': 1}
result = validator(some_data)
result.data
result.errors
# or
data, errors = validator(some_data)
if errors: # not valid
...To think about:
- raising exception on errors?
- if we return errors and data is valid, should we return errors as a empty list or as
None(same goes for data)?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested