Skip to content

root-level link templates #9

@csantero

Description

@csantero

As far as I can tell, the library doesn't support root-level link templates, e.g.

{
    "links": {
        "posts.comments": {
            "href": "/posts/{posts.id}/comments",
            "type": "user"
        }
    },
    "posts": [
        {
            "id": "100",
            "name": "Post 1"
        }, {
            "id": "101",
            "name": "Post 2"
        }
    ]
}

Instead, link templates are included in each resource object, and the values are interpolated in, like so:

{
    "posts": [
        {
            "id": "100",
            "name": "Post 1",
            "links": {
                "comments": {
                    "href": "/posts/100/comments"
                }
            }
        }, {
            "id": "101",
            "name": "Post 2",
            "links": {
                "comments": {
                    "href": "/posts/101/comments"
                }
            }
        }
    ]
}

While there are probably use-cases for the latter, the former has the potential to save considerable amounts of bandwidth and processing time for large result-sets.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions