Schema file not working anymore with Cerberus 1.3
See original GitHub issueUsed Cerberus version / latest commit: Cerberus 1.3 / Python 3.5.2
-
I have the capacity to improve the docs when my problem is solved.
-
I have the capacity to submit a patch when a bug is identified.
-
My question does not concern a practical use-case that I can’t figure out to solve.
Use-case abstract
Since Cerberus 1.3, keyschema and valueschema are deprecated and should still work, but I get an error when using them.
The error is gone when using the new keys keysrules and valuesrules.
Here is my schema :
requests:
type: dict
keyschema:
type: string
valueschema:
type: dict
schema:
aggs:
type: dict
keyschema:
type: string
valueschema:
type: dict
My Python code :
#!/usr/bin/env python3
from yaml import load, load_all
from cerberus import Validator
schemafile = "schema.yml"
with open(schemafile, "r") as f:
schema = load(f)
v = Validator(schema)
And the Python error :
Traceback (most recent call last):
File "./test.py", line 11, in <module>
v = Validator(schema)
File "/usr/local/lib/python3.5/dist-packages/cerberus/validator.py", line 181, in __init__
self.schema = kwargs.get('schema', None)
File "/usr/local/lib/python3.5/dist-packages/cerberus/validator.py", line 562, in schema
self._schema = DefinitionSchema(self, schema)
File "/usr/local/lib/python3.5/dist-packages/cerberus/schema.py", line 76, in __init__
self.validate(schema)
File "/usr/local/lib/python3.5/dist-packages/cerberus/schema.py", line 247, in validate
self._validate(schema)
File "/usr/local/lib/python3.5/dist-packages/cerberus/schema.py", line 263, in _validate
raise SchemaError(self.schema_validator.errors)
cerberus.schema.SchemaError: {'requests': [{'valuesrules': [{'schema': ['no definitions validate', {'anyof definition 0': [{'aggs': [{'valueschema': ['unknown rule'], 'keyschema': ['unknown rule']}]}], 'anyof definition 1': [{'aggs': ['unknown rule']}]}]}]}]}
Bug report / Feature request
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Python Cerberus: problem with validation different schemas ...
It seems that anyof_schema rule works only if all schemas in the provided set describe the same data type (e.g. dictionaries). Why anyof_schema ......
Read more >Cerberus Changelog
Cerberus is a collaboratively funded project, see the funding page. ... (Frank Sachsenheim); Fix: Schema registries do not work on dict fields. Closes...
Read more >Do Not Use If-Else For Validating Data Objects In Python ...
Several weeks ago, I introduced a Python library called Cerberus. It can enable us to write a “schema” to validate our data objects ......
Read more >Cerberus Documentation - Read the Docs
Validation schemas themselves are validated when passed to the validator or a new set of rules is set for a document's field. A...
Read more >How to reset the Python tool - Alteryx Community
As the wheel files are no longer included with the installed ... /wheels/Cerberus-1.3.1.tar.gz Skipping link: wrong project name (not ayx): ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
howdy everyone, v1.3.1 has been released a few minutes ago.
yes, thanks for your feedback.