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

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

晚上API。我需要按 where={"uuid": "my_uuid"} 过滤记录。所以我的 Eve 应用程序 'settings.py' 包含:

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

当我尝试通过 API 调用写东西时,出现错误:

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

Python3.6, 夏娃 1.1, 地狱犬 1.3.2

我做错了什么?

Eve 的 query_objectid_as_string 是资源定制的一部分。您需要将其从架构配置移至域配置。有关更多信息,请参阅文档:

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

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