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
{{ message }}
Repository navigation
When a parameter is missing the error is returned without a source #93
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}
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
{
"errors": [
{
"source": { "pointer": "" },
"detail": "Missing `data` Member at document's top level."
}
]
}
It uses source to point to the top-level of the document (""). (Pointing to “/” would be an appropriate reference to the string "some value" in the request document {"": "some value"}. Pointing to "/data" would be invalid because the request document did not have a value at "/data", and source is always given with reference to the request document.)
Following this format if @pointer is missing from the active record errors serializer class then we can assume that it should be pointing to the /data/attributes node
Activity
JoeWoodward commentedon Sep 2, 2018
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
JoeWoodward commentedon Sep 2, 2018
Actually I think it should reference
'/data/attributes'http://jsonapi.org/examples/#error-objects-source-usage
{ "errors": [ { "source": { "pointer": "" }, "detail": "Missing `data` Member at document's top level." } ] }Following this format if
@pointeris missing from the active record errors serializer class then we can assume that it should be pointing to the/data/attributesnodeJoeWoodward commentedon Sep 2, 2018
#94
bsylvain commentedon Mar 5, 2019
Also if the parameter has been aliased :
The source is empty. There should be a way to set alias for errors also
beauby commentedon Apr 5, 2019
@bsylvain This should be the case, providing you use jsonapi-rb deserializers. Could you show a minimal example where this fails?