diff --git a/pillar/api/custom_field_validation.py b/pillar/api/custom_field_validation.py index bdd35ff2..960686e6 100644 --- a/pillar/api/custom_field_validation.py +++ b/pillar/api/custom_field_validation.py @@ -144,7 +144,7 @@ class ValidateCustomFields(Validator): if not value: self._error(field, "Value is required once the document was created") - def _validator_iprange(self, field_name: str, value: str): + def _check_with_iprange(self, field_name: str, value: str): """Ensure the field contains a valid IP address. Supports both IPv6 and IPv4 ranges. Requires the IPy module. @@ -181,12 +181,12 @@ if __name__ == '__main__': v = ValidateCustomFields() v.schema = { - 'foo': {'type': 'string', 'validator': 'markdown'}, + 'foo': {'type': 'string', 'check_with': 'markdown'}, 'foo_html': {'type': 'string'}, 'nested': { 'type': 'dict', 'schema': { - 'bar': {'type': 'string', 'validator': 'markdown'}, + 'bar': {'type': 'string', 'check_with': 'markdown'}, 'bar_html': {'type': 'string'}, } } diff --git a/pillar/api/eve_settings.py b/pillar/api/eve_settings.py index c84d71cd..6bf9c242 100644 --- a/pillar/api/eve_settings.py +++ b/pillar/api/eve_settings.py @@ -256,7 +256,7 @@ organizations_schema = { 'start': {'type': 'binary', 'required': True}, 'end': {'type': 'binary', 'required': True}, 'prefix': {'type': 'integer', 'required': True}, - 'human': {'type': 'string', 'required': True, 'validator': 'iprange'}, + 'human': {'type': 'string', 'required': True, 'check_with': 'iprange'}, } }, }, diff --git a/pillar/cli/maintenance.py b/pillar/cli/maintenance.py index 30880d35..5f15f9fd 100644 --- a/pillar/cli/maintenance.py +++ b/pillar/cli/maintenance.py @@ -727,7 +727,7 @@ def iter_markdown(proj_node_types: dict, some_node: dict, callback: typing.Calla to_visit.append((subdoc, definition['schema'])) continue coerce = definition.get('coerce') # Eve < 0.8 - validator = definition.get('validator') # Eve >= 0.8 + validator = definition.get('check_with') or definition.get('validator') # Eve >= 0.8 if coerce != 'markdown' and validator != 'markdown': continue diff --git a/tests/test_api/test_cerberus.py b/tests/test_api/test_cerberus.py index 3858ea8c..7424d66c 100644 --- a/tests/test_api/test_cerberus.py +++ b/tests/test_api/test_cerberus.py @@ -185,7 +185,7 @@ class AbstractSchemaValidationTest(AbstractValidationTest): class IPRangeValidatorTest(AbstractSchemaValidationTest): - schema = {'iprange': {'type': 'string', 'required': True, 'validator': 'iprange'}} + schema = {'iprange': {'type': 'string', 'required': True, 'check_with': 'iprange'}} def test_ipv6(self): self.assertValid({'iprange': '2a03:b0c0:0:1010::8fe:6ef1'})