Skip to content
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

Schema error when using "description" or "example", unknown rule #1264

rmlopes opened this issue Apr 29, 2019 · 1 comment

Schema error when using "description" or "example", unknown rule #1264

rmlopes opened this issue Apr 29, 2019 · 1 comment


Copy link

@rmlopes rmlopes commented Apr 29, 2019

Expected Behavior

The description and example properties are used in the documentation. Description is a string, and example an instance of the entity.

# eve-demo
# Add "description" to one of the entities

Actual Behavior

Error in POST:

Traceback (most recent call last):
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/flask/", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/flask/", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/flask/", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/flask/", line 35, in reraise
    raise value
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/flask/", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/flask/", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/eve/", line 58, in collections_endpoint
    response = post(resource)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/eve/methods/", line 318, in rate_limited
    return f(*args, **kwargs)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/eve/", line 80, in decorated
    return f(*args, **kwargs)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/eve/methods/", line 1351, in decorated
    r = f(resource, **combined_args)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/eve/methods/", line 49, in post
    return post_internal(resource, payl, skip_validation=False)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/eve/methods/", line 167, in post_internal
    schema, resource=resource, allow_unknown=resource_def["allow_unknown"]
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/eve/", line 28, in __init__
    super(Validator, self).__init__(*args, **kwargs)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/cerberus/", line 169, in __init__
    self.schema = kwargs.get('schema', None)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/cerberus/", line 509, in schema
    self._schema = DefinitionSchema(self, schema)
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/cerberus/", line 69, in __init__
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/cerberus/", line 197, in validate
  File "/home/rmlopes/dev/knowLOGIS/knowlogisAPI/__py_venv__/lib/python3.5/site-packages/cerberus/", line 219, in _validate
    raise SchemaError(self.schema_validator.errors)
cerberus.schema.SchemaError: {'firstname': [{'description': ['unknown rule']}]}


  • Python version: 3.5
  • Eve version: 0.9
  • Cerberus:1.2

This is reported at the swagger extension but I believe is a core problem. The examples are simpler at eve-demo hence it is uncaught.

Copy link

@nicolaiarocci nicolaiarocci commented May 2, 2019

Actually, this is due to Cerberus 1.0+ dropping support for transparent_schema_rules. When we did that, we did not upgrade Eve and Eve-Swagger docs accordingly. Right now, in order to add support for description and example eve-swagger options, you have to supply a custom validator, as suggested in eve-swagger README (which needs to be amended to get rid of the now non-existent transparent_schema_rules option)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants