You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you say, default values have nothing to do with validation. Cerberus does not edit the dictionary in any way, therefore could not provide this service. Defaults should be handled before validation, maybe by recurring to the handy setdefault(docs) method.
Now, if your intended context was the Eve REST API Framework then yes, default values for collection schemas would probably make for a nice feature. Consider opening a feature request issue @ Eve repo in that case.
I've been thinking about this and actually ended up implementing a default constraint for Cerberus. It is actually very similar to required since for the purpose of validation a default value simply means that the field must be present, and it must carry a value (string fields cannot be empty). This will allow for a richer grammar when defining schemas, and pre-processors will have an easier game at supporting default values (think Eve). Stay tuned.
Although not part of validation, where would be best place to specify default values?
The text was updated successfully, but these errors were encountered: