0

I'd like to overload validate in my custom validator class so that if the client only gives me text, I can convert it to yaml for validation.

I've tried the following:

import cerberus
from cerberus import Validator
from ruamel.yaml import YAML

class SchemaValidator(Validator):
    def _validate(self, schema_to_check_in_text, schema_from_catalog_in_yaml):
        ruamel_yaml = YAML()
        parsed_proposed_yaml = ruamel_yaml.load(schema_to_check_in_text)

        self.validate(parsed_proposed_yaml, schema_from_catalog_in_yaml)

But it doesn't work. Is this possible?

1 Answer 1

1

You're not overloading anything, but adding an extra method that you marks as private per convention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.