-
Notifications
You must be signed in to change notification settings - Fork 130
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
Hierarchical URIs #273
Comments
This would depend on the data model, right? If the parent entity is eagerly loaded with the |
Agreed. The short-circuiting should be opportunistic so as to avoid a mandatory double query penalty. |
I guess my point is that in my second example, it would be nice to still define the relationship within Liberator, but also not have the unnecessary double query. Maybe that's what you mean by "opportunistic"? |
Yep. If the parent doesn't exist, and it's cheap to determine and/or beneficial to query independently, then allow it. But don't require it. |
I have thought about this before and I did not come to a conclusion yet. I think this would required deeper integration with a routing library to make effective use of the parent-child relationship. But in the end, all what a liberator resource does to query the existence of a resource is to call |
Is there are reasonable way using liberator resources to incrementally validate hierarchical URIs? Regardless of the HTTP and other attributes of the HTTP request, if the parent resources don't exist in a hierarchy, it is reasonable to return a "Not Found" before processing the request at the terminal resource.
Example: A PUT request to
/foos/123/bars/876
should fail with "Not Found" if the ancestor resources (foos
,foos/123
,foos/123/bars
) do not exist.It would be helpful if the infrastructure of liberator could be applied to short-circuiting requests to resources whose ancestors do not exist.
The text was updated successfully, but these errors were encountered: