js-data-jsonapi icon indicating copy to clipboard operation
js-data-jsonapi copied to clipboard

Revert Breaks $_JSONAPIMETA_

Open rgant opened this issue 8 years ago • 2 comments
trafficstars

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

rgant avatar Jan 26 '17 16:01 rgant

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

BlairAllegroTech avatar Feb 05 '17 09:02 BlairAllegroTech

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": "[email protected]",
    "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": "[email protected]",
    "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.

rgant avatar Feb 06 '17 14:02 rgant