You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
The text was updated successfully, but these errors were encountered:
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 likehttp://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:
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 withclient.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.
The text was updated successfully, but these errors were encountered: