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
If I use swagger_spec_validator on this, it fails:
$ python -c 'import swagger_spec_validator as v; v.validate_spec_url("file:///tmp/swagger.json")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 22, in wrapper
sys.exc_info()[2])
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 17, in wrapper
return method(*args, **kwargs)
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/util.py", line 53, in validate_spec_url
validator.validate_spec(spec_json, spec_url)
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/validator20.py", line 82, in validate_spec
http_handlers=http_handlers)
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 22, in wrapper
sys.exc_info()[2])
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 17, in wrapper
return method(*args, **kwargs)
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/validator20.py", line 125, in validate_json
cls=Draft4Validator)
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/ref_validators.py", line 34, in validate
instance_cls(schema, *args, **kwargs).validate(instance)
File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/jsonschema/validators.py", line 123, in validate
raise error
swagger_spec_validator.common.SwaggerValidationError: {u'examples': {u'application/vnd.example+json': [u'foo', u'bar']}, u'description': u'array of strings', u'schema': {u'items': {u'type': u'string'}, u'type': u'array'}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:
{'oneOf': [{'$ref': '#/definitions/response'},
{'$ref': '#/definitions/jsonReference'}]}
On instance['paths'][u'/products']['get']['responses'][u'200']:
{u'description': u'array of strings',
u'examples': {u'application/vnd.example+json': [u'foo', u'bar']},
u'schema': {u'items': {u'type': u'string'}, u'type': u'array'}}
It appears that the reason for the failure is the period in the MIME type used in the examples object. If I remove the period:
Here is a very simple swagger spec, which I created with the Swagger Editor:
If I use swagger_spec_validator on this, it fails:
It appears that the reason for the failure is the period in the MIME type used in the
examples
object. If I remove the period:then validation passes:
The text was updated successfully, but these errors were encountered: