Added PillarServer.validator_for_resource()

This makes it possible to perform Cerberus validation on documents.
This commit is contained in:
Sybren A. Stüvel 2017-05-18 16:32:05 +02:00
parent 1f0a855510
commit ef2d8d14a0

View File

@ -618,6 +618,11 @@ class PillarServer(Eve):
yield ctx yield ctx
def validator_for_resource(self, resource_name: str) -> custom_field_validation.ValidateCustomFields:
schema = self.config['DOMAIN'][resource_name]['schema']
validator = self.validator(schema, resource_name)
return validator
def _get_current_app(): def _get_current_app():
"""Returns the current application.""" """Returns the current application."""