Route Aliases #239

Closed
atuttle opened this Issue Dec 6, 2014 · 4 comments

Projects

None yet

2 participants

@atuttle
Owner
atuttle commented Dec 6, 2014

It is conceivable that you might want both /artists/42/albums and /albums?artistId=42 as usable routes in the same API.

taffy:uri should continue to support a string as its data, but should also support an array of strings, where each string would be a URI alias to the same resource.

  1. Would the array need to be JSON to make it easier to parse? If not, what are the syntax rules? If so, does that mean we need to require the outer quotation marks to be single-quotes? (I'd rather not...)
  2. What affect does this have on the dashboard? Should all aliases be grouped together or should they be listed in matching order as routes are currently, and just duplicate the UI? Same questions for the auto-generated documentation.
@atuttle atuttle added this to the Future milestone Dec 6, 2014
@ryanguill
Collaborator

What branch would I target for this PR? Develop?

@atuttle
Owner
atuttle commented Dec 7, 2014

Master is fine as long as the tests are all passing.

@ryanguill ryanguill added a commit to ryanguill/Taffy that referenced this issue Dec 9, 2014
@ryanguill ryanguill atuttle#239
Added the ability to specify a comma delimited list of URIs for taffy_uri, allowing you to specify multiple endpoint URIs to be served by the same resource .  It will not recognize commas inside of regular expression brackets {}.

Fixed an issue where status.skippedResources was being overwritten when hot-swapping.

Added tests for the new alias', as well as reconfiguring the tests to keep testing the skippedResources properly.

Added a test for conflicting URI errors.
ae4979e
@ryanguill
Collaborator

Regarding your questions - my opinion (and my forthcoming PR) is that an alias should be treated just as if you made a copy of the resource and only changed the URI - an alias is just a way to tie two separate URI's to the same resource. It will be up to the developer to default any appropriate arguments to methods.

I have implemented it to just be a comma separated list for the URIs. I wanted to use a URL, but the support for that really isn't there in the custom metadata. I have written a function that splits on the comma properly, even if the comma is used inside of a regex token.

The dashboard repeats the same endpoint name with the separate URI, same with the generated documentation.

@ryanguill
Collaborator

#240

Let me know if you would like to change anything - I tried to keep formatting the same, but its possible I missed something. Also let me know if you disagree with my conclusions about how the alias' should be handled.

@atuttle atuttle modified the milestone: Taffy 3.1, Future Jan 24, 2015
@atuttle atuttle closed this Jan 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment