Skip to content
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

Remove extra attributes #16

Closed
rgant opened this issue Jul 5, 2016 · 3 comments
Closed

Remove extra attributes #16

rgant opened this issue Jul 5, 2016 · 3 comments

Comments

@rgant
Copy link
Contributor

rgant commented Jul 5, 2016

I've noticed that the data.attributes sent to the server contains an extra key called "$JSONAPIMETA".

There is a similar issue with $$hashKey which is added by ng-repeat from Angular. js-data resolved a bug with this key in js-data/js-data-angular#208

I added checks for these two values here: https://github.com/BlairAllegroTech/js-data-jsonapi/blob/js-data-jsonapi/src/JsonApiSerializer.ts#L861

if (prop === options.idAttribute || prop === JSONAPI_META || prop === '$$hashKey') {
    continue;
}

It might be better to keep track of which attributes came from the server and which didn't, but then you get into issues with

@BlairAllegroTech
Copy link
Owner

Thanks, i was of the understanding that js-data ignored properties starting with '$' but this may just be for change tracking.

I'll strip this property off of any outgoing requests in the serializer.

@rgant
Copy link
Contributor Author

rgant commented Jul 6, 2016

Interesting, let me check the spec, maybe I did the API wrong.

Hmmm, in the upcoming version (v1.1) I see that the spec will ignore "@-members":
http://jsonapi.org/format/upcoming/#document-member-names-at-members

Problem with that is that so many of the JS libraries use $ for internal stuff. Maybe that will change before the spec gets released.

-_Rob

On Tue, Jul 5, 2016 at 9:27 PM Blair notifications@github.com wrote:

Thanks, i was of the understanding that js-data ignored properties
starting with '$' but this may just be for change tracking.

I'll strip this property off of any outgoing requests in the serializer.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#16 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AArXmQEpD7WQwGdSy-82t429BFItJDsoks5qSwR9gaJpZM4JFXFI
.

@BlairAllegroTech
Copy link
Owner

No i thought js-data would ignore all attributes starting with $. I had assumed it would not send them..
But i think this may just be for change tracking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants