-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When a parameter is missing the error is returned without a source #93
Comments
Been investigating and although this seems like it would be useful for debugging it's actually against the RFC6901 definition. A pointer can only point to a JSON key and cannot point to a missing key. However, maybe it can be returned in the meta to help with debugging |
Actually I think it should reference {
"errors": [
{
"source": { "pointer": "" },
"detail": "Missing `data` Member at document's top level."
}
]
}
Following this format if |
Also if the parameter has been aliased :
The source is empty. There should be a way to set alias for errors also |
@bsylvain This should be the case, providing you use jsonapi-rb deserializers. Could you show a minimal example where this fails? |
Currently when my model validates a value that was completely excluded from the payload I get a response with empty pointers.
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 errorMissing 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
The text was updated successfully, but these errors were encountered: