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

Consistent return type for .validate()? #155

Open
ytrepus opened this issue Jul 28, 2017 · 2 comments
Open

Consistent return type for .validate()? #155

ytrepus opened this issue Jul 28, 2017 · 2 comments
Milestone

Comments

@ytrepus
Copy link

ytrepus commented Jul 28, 2017

Hello,

It seems a little awkward for .validate to return a single boolean True when the configspec is validated, but a dict when there is an error (especially since the non-empty dict is evaluated as True which can be misleading). Almost feels like there should be a .validate that is always boolean, False if any one of the validations failed, and then a validate.detail or something that always has a dict with {field: validation result}, even if the validation is all True.

Also is it possible to replace values where validate failed with a default as specified in the configspec? I'm currently doing this manually by iterating over the .validate if validate is not True (which is what prompted the above).

If any of this is user error, my apologies; I am new to the library (but finding it very helpful so far!)

Thanks a lot,
Rob

@maxslimmer
Copy link

@ytrepus For your second part you might want to watch issue #136

@robdennis
Copy link
Member

changing the return type of validate does feel like a non-backwards compatible thing, but it seems worth considering so move it to Someday

@robdennis robdennis added this to the Someday milestone Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants