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

Extending beyond RFC6570 #14

Open
dblock opened this issue Aug 15, 2015 · 2 comments
Open

Extending beyond RFC6570 #14

dblock opened this issue Aug 15, 2015 · 2 comments

Comments

@dblock
Copy link

dblock commented Aug 15, 2015

We use uri_template in Hyperclient, https://github.com/codegram/hyperclient. Most of the time you have an URI template in some resource and you expand it. For example a link could be http://example.com/widgets/{id}. However sometimes you have things like http://example.com/widgets/{?sort,size,page,offset} which is rather annoying and ends up being copy-pasted all over the place, or usually just forgotten by the API developers.

In code this is used like so:

client.widgets(id: 1)
client.widgets(sort: 'created_at', size: 10)
...

We would like to generally be able to omit these parameters, but still include them in the resulting URI. So a template like http://example.com/widgets{?size} could actually be expanded with client.widgets(sort: 'created_at'), basically using the template as a hint as opposed to a hard requirement.

Furthermore we'd like to fail when a required parameter is missing. Anything that's not a query parameter should probably be required.

See codegram/hyperclient#84.

Generally just looking for feedback. Is an implementation like this in scope of this library? If so I would probably refactor rfc6570.rb somewhat into a generic base, the old rfc6570 implementation and a variation described above.

@dblock
Copy link
Author

dblock commented Aug 15, 2015

@dblock
Copy link
Author

dblock commented Mar 13, 2016

@hannesg This keeps coming up, maybe care to comment? Thanks!

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

No branches or pull requests

2 participants
@dblock and others