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

Add support for CURIES #2

Open
nareshbhatia opened this issue Feb 18, 2014 · 5 comments
Open

Add support for CURIES #2

nareshbhatia opened this issue Feb 18, 2014 · 5 comments

Comments

@nareshbhatia
Copy link

Add support for CURIES. See HAL specification: http://tools.ietf.org/pdf/draft-kelly-json-hal-06.pdf. Also see clarification here: https://groups.google.com/forum/#!topic/hal-discuss/1ZpslQ2GmG0

@jpbochi
Copy link
Owner

jpbochi commented Mar 11, 2014

@nareshbhatia I was thinking about how to implement this.

I'd need something to join http://haltalk.herokuapp.com/docs/{rel} and /posts/latest into http://haltalk.herokuapp.com/docs/posts/latest. I guess there are some hidden rules there. A simple replace would create two slashes between docs and posts. Are you using any link templating library? Do you have any to suggest? It might be a good idea to use it here instead of building something from scratch.

@jpbochi
Copy link
Owner

jpbochi commented Mar 11, 2014

https://www.npmjs.org/package/uritemplate looks good, and has no dependencies.

@jpbochi
Copy link
Owner

jpbochi commented Mar 11, 2014

That's interesting.

> require('uritemplate').parse('http://haltalk.herokuapp.com/docs/{rel}').expand({ rel: '/some/where' })
'http://haltalk.herokuapp.com/docs/%2Fsome%2Fwhere'
> require('uritemplate').parse('http://haltalk.herokuapp.com/docs/{+rel}').expand({ rel: '/some/where' })
'http://haltalk.herokuapp.com/docs//some/where'

@jpbochi
Copy link
Owner

jpbochi commented Mar 11, 2014

Tested with https://www.npmjs.org/package/uri-template, too and it does the same thing.

And apparently, they are correct. See http://tools.ietf.org/html/rfc6570#section-3.2.3

@jpbochi
Copy link
Owner

jpbochi commented Mar 11, 2014

Started a thread on hal-discuss. https://groups.google.com/forum/#!topic/hal-discuss/3hwoWts4GkQ

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