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

Support extraction #1

Open
lalloni opened this issue Sep 4, 2012 · 1 comment
Open

Support extraction #1

lalloni opened this issue Sep 4, 2012 · 1 comment

Comments

@lalloni
Copy link

lalloni commented Sep 4, 2012

It would be most useful if URITemplate were an extractor for obtaining variables' values from an otherwise expanded URI.

Of course that being an extractor as scala's pattern matcher knows would be a great detail.

While I'm willing to implement this I'm quite lost after diving into the code.

If you can think of a way of implementing this, I can offer some of my work hours for getting it done.

@teigen
Copy link
Owner

teigen commented Sep 6, 2012

Thats a very cool idea.
If you go about implementing this you only really need to deal with this part of the code https://github.com/teigen/uri-template/blob/master/src/main/scala/URITemplate.scala#L49-127
Everything above is support for the 'expand("foo" := "bar")' syntax, and everything below is the parser.

Support for Level 1, 2 and 3 should be doable. You would have to write the reverse of https://github.com/teigen/uri-template/blob/master/src/main/scala/URITemplate.scala#L85.

Level 4 brings support for Lists and Maps as variables and value modifiers which will be a lot harder.

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