Alex
Alex

Reputation: 98

cerberus.schema.SchemaError: {'uuid': [{'query_objectid_as_string': ['unknown rule']}]}

Eve API. I need to filter records by where={"uuid": "my_uuid"}. So my 'settings.py' for the Eve application contains:

'schema': {
        'uuid': {
             'type': 'string',
             'required': True,
             'query_objectid_as_string': True,
             'data_relation': {
                 'resource': 'users',
                 'field': 'uuid',
                 'embeddable': True
             }
         }
    }

When I try to write something by API call, I get error:

cerberus.schema.SchemaError: {'uuid': [{'query_objectid_as_string': ['unknown rule']}]}

Python3.6, Eve 1.1, Cerberus 1.3.2

What I am doing wrong?

Upvotes: 2

Views: 1079

Answers (1)

gcw
gcw

Reputation: 1621

Eve's query_objectid_as_string is part of Resource customization. You need to move it from Schema configuration to Domain configuration. See the docs for more:

Schema - https://docs.python-eve.org/en/stable/config.html#schema-definition

Domain - https://docs.python-eve.org/en/stable/config.html#domain-configuration

Upvotes: 1

Related Questions