Open
Description
Currently when my model validates a value that was completely excluded from the payload I get a response with empty pointers.
{
"errors": [
{
"title": "Invalid user_id",
"detail": "User can't be blank",
"source": {}
}
],
"jsonapi": {
"version": "1.0"
}
}
In rails we know the source ahead of time. If it's not a query parameter then it must be a pointer.
3 situations...
resource :user, only: :show
and no id is passed or we return 404 error
/url?page=1
we would either not require it or return a custom error
Missing payload attribute we should automatically infer the expected type and value of the source object e.g. source = { pointer: '/data/attributes/user_id
}
This would then return
{
"errors": [
{
"title": "Invalid user_id",
"detail": "User can't be blank",
"source": {
"pointer": "/data/attributes/user_id"
}
}
],
"jsonapi": {
"version": "1.0"
}
}
Metadata
Metadata
Assignees
Labels
No labels