BlairAllegroTech / js-data-jsonapi

JsonApi Adapter for js-data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Revert Breaks $_JSONAPIMETA_

rgant opened this issue · comments

Calling DS#revert on a js-data-jsonapi resource reverts some of the $_JSONAPIMETA_ breaking relationships. More details to follow.

Glad you're back....
I must admit i haven't been working on this project but I'll start getting back into it again..

Sorry this took me a bit to get. Here is a JSON dump of the Users Resource before revert:

{
    "phone": "123",
    "type": "admin",
    "created_at": "2016-06-11T13:46:39+00:00",
    "notification_dt": null,
    "last_name": "McTesty",
    "updated_at": "2016-12-19T21:49:55+00:00",
    "email": "test.mctesty@example.com",
    "first_name": "Test",
    "title": "1321",
    "email_status": {},
    "id": "1566",
    "$_JSONAPIMETA_": {
        "selfType": "users",
        "selfLink": "/v3/users/me",
        "isJsonApiReference": false,
        "relationships": {
            "account": {
                "related": {
                    "type": "accounts",
                    "url": "/v3/users/me/account"
                }
            }
        },
        "links": {
            "self": {
                "type": "self",
                "url": "/v3/users/me",
                "meta": {}
            }
        },
        "referenceCount": 1
    }
}

And here is after revert:

{
    "phone": "123",
    "type": "admin",
    "created_at": "2016-06-11T13:46:39+00:00",
    "notification_dt": null,
    "last_name": "McTesty",
    "updated_at": "2016-12-19T21:49:55+00:00",
    "email": "test.mctesty@example.com",
    "first_name": "Test",
    "title": "1321",
    "email_status": {},
    "id": "1566",
    "$_JSONAPIMETA_": {
        "selfType": "users",
        "selfLink": "/v3/users/me",
        "isJsonApiReference": false,
        "relationships": {},
        "links": {
            "self": {
                "type": "self",
                "url": "/v3/users/me",
                "meta": {}
            }
        },
        "referenceCount": 1
    }
}

It looks like for some reason relationships is cleared.