Reputation: 938
I would like to do a sort of "pre-validation" of a schema to enforce certain fields are included in a schema used in an Eve resource. I see that we can validate and extend validation using Cerberus (http://docs.python-cerberus.org/en/latest/customize.html). I don't want to validate the data against the schema, but that the schema contains certain fields itself.
My application is created by allowing other teams in my organization to provide their own resources, and I have a few fields that I would like to enforce that they provide in their schemas.
Is this possible with Eve/Cerberus? I assume that it probably is not and I will have to roll my own. If it isn't available, when is the proper time to inject this validation of the schema?
Upvotes: 0
Views: 293
Reputation: 6576
I am not sure I understand your question. You can make sure a field is included by setting the required
constraint on it. You can also set a default
value for a missing field if that can be of any help. See Schema Definition in the documentation for details.
Upvotes: 1