You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/Users/jstewmon/Library/Application Support/IntelliJIdea2016.1/python/helpers/pydev/pydevd.py", line 1530, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/Users/jstewmon/Library/Application Support/IntelliJIdea2016.1/python/helpers/pydev/pydevd.py", line 937, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Users/jstewmon/Library/Preferences/IntelliJIdea2016.1/scratches/scratch_158", line 11, in <module>
validate({200: 'hello'}, schema)
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/validators.py", line 478, in validate
cls(schema, *args, **kwargs).validate(instance)
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/validators.py", line 122, in validate
for error in self.iter_errors(*args, **kwargs):
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/validators.py", line 98, in iter_errors
for error in errors:
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/_validators.py", line 14, in patternProperties
if re.search(pattern, k):
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/re.py", line 146, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or buffer
A similar, but discrete, error occurs when additionalProperties is False:
Traceback (most recent call last):
File "/Users/jstewmon/Library/Application Support/IntelliJIdea2016.1/python/helpers/pydev/pydevd.py", line 1530, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/Users/jstewmon/Library/Application Support/IntelliJIdea2016.1/python/helpers/pydev/pydevd.py", line 937, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Users/jstewmon/Library/Preferences/IntelliJIdea2016.1/scratches/scratch_158", line 11, in <module>
validate({200: 'hello'}, schema)
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/validators.py", line 478, in validate
cls(schema, *args, **kwargs).validate(instance)
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/validators.py", line 122, in validate
for error in self.iter_errors(*args, **kwargs):
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/validators.py", line 98, in iter_errors
for error in errors:
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/_validators.py", line 25, in additionalProperties
extras = set(_utils.find_additional_properties(instance, schema))
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/site-packages/jsonschema/_utils.py", line 100, in find_additional_properties
if patterns and re.search(patterns, property):
File "/Users/jstewmon/.virtualenvs/pre-commit-swagger/lib/python2.7/re.py", line 146, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or buffer
The text was updated successfully, but these errors were encountered:
You are trying to validate an property name by giving an number instead of a string eg. test with
validate({'200': 'hello'}, schema)
notice the string instead of the number 200 vs '200'
If you actually want to verify a number as a property name, I don't thinks this is supported, but I might be mistaking.
Example:
Result:
A similar, but discrete, error occurs when
additionalProperties
isFalse
:Result:
The text was updated successfully, but these errors were encountered: