Closed benbarber closed 6 years ago
Hi Ben, thanks! Semantically, JSON pointers refer to part of a JSON document (here the POST/PATCH body), so a missing attribute does not really have a corresponding JSON pointer, since it does not exist in the request document. We could probably default it to /data/attributes
though. What do you think?
After reading the JSON Pointer RFC6901 I think the current implementation is correct and shouldn't be changed, it suggests that the target of the pointer should be present in the JSON document.
I have just migrated an API over to use this Gem from using ActiveModelSerializers and their error serializer includes these pointers in the response, that's the only breaking change encountered but it's a technically correct one.
That's great to hear!
On Tue, 19 Sep 2017 at 20:17, Ben Barber notifications@github.com wrote:
Closed #60 https://github.com/jsonapi-rb/jsonapi-rails/issues/60.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/jsonapi-rb/jsonapi-rails/issues/60#event-1256010875, or mute the thread https://github.com/notifications/unsubscribe-auth/ACHPYoD-y5KS1cTIIo4-HNS1hinRKG2Lks5skAVJgaJpZM4PchOl .
-- Lucas Hosseini lucas.hosseini@gmail.com
How do you manage presence validations considering that pointers are only present when the attribute is in the payload? I am using ember data aloong with this gem and I can't get the errors to work because pointers are returning {} when a value is unfilled in a form.
When an attribute is set as required in the model but not sent across in the request payload, the error gets included in the error JSON:API error response but the source pointer doesn't get set with it.
I'm currently not using any custom Deserializers and returning the errors as below;
Any help on how to resolve this will be appreciated. Great work on this Gem by the way.