-
-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: unhashable type: 'list' with jsonschema v4.7.1 #973
Comments
During creation of a simplified example, I have located the crux of the issue. Per the json schema spec, a type can be a single primitive which is represented by a string or multiple primitives which is represented by an array. It seems that with the latest update, jsonschema cannot handle an array being specified. Spec link: "... also includes a "type" keyword which can independently restrict the instance to one or more primitive types. This allows for a concise expression of use cases such as a function that might return either a string of a certain length or a null value: { Adding a mention for @Julian since that is who performed the commit. |
Hi. Please share some code which produces the error. |
Never mind, I think I see what you're running. Thanks for the report, I believe |
Yes, the issue is resolved. I appreciate the quick turn around. I apologize for not providing a full working proof. |
No problem, thanks again. |
When using the latest jsonschema v4.7.1, I am seeing the following error during schema validation:
../venv/lib/python3.9/site-packages/jsonschema/validators.py:1057: in validate
error = exceptions.best_match(validator.iter_errors(instance))
../venv/lib/python3.9/site-packages/jsonschema/exceptions.py:377: in best_match
best = max(itertools.chain([best], errors), key=key)
../venv/lib/python3.9/site-packages/jsonschema/exceptions.py:327: in relevance
not error._matches_type(),
../venv/lib/python3.9/site-packages/jsonschema/exceptions.py:150: in _matches_type
return self._type_checker.is_type(self.instance, expected_type)
../venv/lib/python3.9/site-packages/jsonschema/_types.py:118: in is_type
fn = self._type_checkers[type]
../venv/lib/python3.9/site-packages/pyrsistent/_pmap.py:70: in getitem
return PMap._getitem(self._buckets, key)
../venv/lib/python3.9/site-packages/pyrsistent/_pmap.py:61: in _getitem
_, bucket = PMap._get_bucket(buckets, key)
buckets = pvector([[('string', <function is_string at 0x10dd50e50>)], None, [('object', <function is_object at 0x10dd50dc0>)], [...e, [('null', <function is_null at 0x10dd50ca0>)], [('integer', <function at 0x10dd50f70>)], None, None, None])
key = ['string', 'null']
E TypeError: unhashable type: 'list'
If I go back and target v4.6.2 this issue does not occur. It appears all instances where this issue is occurring is on validation failures when using regex pattern validation. I will try to put together a simplified example of this issue.
The text was updated successfully, but these errors were encountered: