Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Add route discovery based on type #578

Closed
danielbachhuber opened this issue Nov 4, 2014 · 2 comments
Closed

Add route discovery based on type #578

danielbachhuber opened this issue Nov 4, 2014 · 2 comments

Comments

@danielbachhuber
Copy link
Member

As a core endpoint author, I'd like to be able to embed a reference to a User (e.g. author) from my Post.

Currently, this relationship is strongly coupled:

// Entity meta
$links = array(
        'self'       => array(
                'href' => json_url( '/posts/' . $post['ID'] ),
        ),
        'author'     => array(
                'href' => json_url( '/users/' . $post['post_author'] ),
        ),
        'collection' => array(
                'href' => json_url( '/posts' ),
        ),
);

My Post Resource shouldn't need to know of the route to the User Resource. My Post Resource be able to return the relationship in a structured manner, and have the Server resolve the proper route.

Related #559, #577

@danielbachhuber danielbachhuber added this to the 2.0 milestone Nov 4, 2014
@rmccue rmccue mentioned this issue Nov 4, 2014
46 tasks
@rmccue rmccue changed the title Add object type-to-route mapping to index for discoverability Add route discovery based on type Nov 5, 2014
@rmccue
Copy link
Member

rmccue commented Nov 5, 2014

Related: #577

@danielbachhuber
Copy link
Member Author

We've discussed this ad-naseum, and no good solution has presented itself. Registry is one challenge. Resolving a Resource route based on its regex and ID would require creating a library — ick.

For now, let's "hardcode" these links. When hardcoding becomes an actual problem, we can re-address.

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

No branches or pull requests

2 participants