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

Adapt HookHandler to allow listing of routes #96

Closed
ljucam opened this issue Dec 14, 2016 · 0 comments
Closed

Adapt HookHandler to allow listing of routes #96

ljucam opened this issue Dec 14, 2016 · 0 comments
Assignees

Comments

@ljucam
Copy link
Collaborator

ljucam commented Dec 14, 2016

Currently it’s not possible to list routes in a collection.

PUT /collection/resource1
PUT /collection/resource2/_hook/route
GET /collection/resource2 => HookHandler -> Forwarder
GET /collection => Resource storage => { "collection": [ "resource1" ] }

In order to be able to list routes in a collection, we have to adapt the HookHandler. This way a request to a parent collection will check, if routes exist and if so, list them properly. Therefor the HookHandler takes control of creating the listing, if a route - handled by the HookHandler – is present (not the Router), otherwise the Router takes control.

PUT /collection/resource1
PUT /collection/resource2/_hook/route
GET /collection/resource2 => HookHandler -> Forwarder
GET /collection => HookHandler -> Resource Storage + Route hook list => { "collection": [ "resource1", "resource2" ] }

Extend the configuration of Hooks for Routes with two new attributes ‘listable’ and ‘collection’.
listable => if true routes will be shown, otherwise not (current behavior)
collection => because it’s not visible by an URL, if it points to a collection or a resource, we need to specify if the rout is a collection (default) or a resource. This is necessary if the listable feature is used with for example the expand feature.

{ "destination": ..,          // as usual 
  "listable": false,          // new, allows to override the default
  "collection": false }       // new, indicates if route points to collection or resource. 

We also need a new constructor, which allows to set the default for the listable feature:
new HookHandler(...., true) // enable / disable listable as default

@ljucam ljucam self-assigned this Jan 3, 2017
@lbovet lbovet closed this as completed in 31c12db Jan 17, 2017
lbovet added a commit that referenced this issue Jan 17, 2017
fixed  #96 Adapt HookHandler to allow listing of routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant