flask-resty
flask-resty copied to clipboard
Inspect violated constraints
cc @cancan101 @itajaja
This is obviously very rough and the final API will need to be more flexible, but the basic approach appears to work. Thoughts?
I think one option would be to make this lookup be a set of utility function and then let the writer of the view decide how they want to do the mapping of the pg error to the api error.
@sloria since you looked at this – is there an easy way to go from attribute name to data key, given a schema?
I think it'd be
attr_to_data_key = {
field.attribute or field_name: field.data_key or field_name
for field_name, field in schema.fields.items()
}