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
---> 33 jsonschema.validate(value, spec)
34
35
/usr/lib/pymodules/python2.6/jsonschema/validators.pyc in validate(instance, schema, cls, *args, **kwargs)
504 """
505 if cls is None:
506 cls = validator_for(schema)
--> 507 cls.check_schema(schema)
508 cls(schema, *args, **kwargs).validate(instance)
/usr/lib/pymodules/python2.6/jsonschema/validators.pyc in check_schema(cls, schema)
74 def check_schema(cls, schema):
75 for error in cls(cls.META_SCHEMA).iter_errors(schema):
---> 76 raise SchemaError.create_from(error)
77
78 def iter_errors(self, instance, _schema=None):
SchemaError: False is not of type u'array'
Failed validating u'type' in schema[u'properties'][u'required']:
{u'items': {u'type': u'string'},
u'minItems': 1,
u'type': u'array',
u'uniqueItems': True}
On instance[u'required']:
False
It looks like swagger_spec can not be directly treated as json_schema to validate the request.
On removing required field from the spec, and retrying gives:
ValidationError: ['available'] is not one of [u'available', u'pending', u'sold']
Failed validating u'enum' in schema:
{u'collectionFormat': u'multi',
u'default': u'available',
u'description': u'Status values that need to be considered for filter',
u'enum': [u'available', u'pending', u'sold'],
u'in': u'query',
u'items': {u'type': u'string'},
u'name': u'status',
u'type': u'array'}
On instance:
['available']
In other words, jsonschema.validate will not work in these cases.
The text was updated successfully, but these errors were encountered:
We should create our own validators using jsonschema. It actually provides an excellent mechanism for doing this, and the author is very strict about keeping backwards compatibility.
I tried this:
Which throws back:
It looks like
swagger_spec
can not be directly treated asjson_schema
to validate the request.On removing
required
field from the spec, and retrying gives:In other words,
jsonschema.validate
will not work in these cases.The text was updated successfully, but these errors were encountered: