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
@app.route('/<resource_name>/<item_id>', methods=['DELETE'])
def custom_delete(resource_name, item_id):
# Check if the resource allows soft delete and has no schema defined
if app.config.get('SOFT_DELETE', False) and resource_name in app.config['DOMAIN'] and 'schema' not in app.config['DOMAIN'][resource_name]:
# Return a custom error response for the 412 status code
response = {
'_status': 'ERR',
'_error': {
'code': 412,
'message': 'Soft delete is enabled, but resource has no schema defined. Please define a schema or disable soft delete.'
}
}
return response, 412
Expected Behavior: 204 NO CONTENT
Actual Behavior: 412 PRECONDITION FAILED
If
SOFT_DELETE
is set toTrue
on a global level and an endpoint is defined without a schema, it becomes impossible to delete.Example endpoint:
I found two work arounds:
'soft_delete': False
to the configuration'allow_unknown': False
and define a schemaEither the response should be someting else becase the
_etag
is correct or the bug should be fixed.Environment
The text was updated successfully, but these errors were encountered: