Support for RFC 6570 #67

Merged
merged 12 commits into from May 21, 2012

Projects

None yet

3 participants

@therabidbanana

Could probably still use a lot of cleaning up and more tests, but here's a start to support the RFC version of uri templates. To keep backwards compatibility I subclassed Addressable::Template with Addressable::UriTemplate.

Partial expand and expand should both work pretty well, match may still have edge cases to work out, since there are a lot of UriTemplate expressions that aren't necessarily reversible.

@sporkmonger
Owner

Oh wow, nice! Could you do me a favor though? Don't worry about backwards compatibility. Forget about subclassing, just replace what's there now with this. I'll do any cleanup necessary afterwards. My intention was that the introduction of RFC 6570 support would be a major version update and thus I'm 100% OK with making it a breaking change.

@therabidbanana

Got everything moved into the new class and removed the old one. Also removed the old specs, since most of them were related to old style operators like -list and -suffix. Probably need more tests for matching and custom processors with the new class though.

@sporkmonger sporkmonger merged commit b618ca0 into sporkmonger:master May 21, 2012
@sporkmonger
Owner

So this pull caused a few things to break on some of the versions of Ruby. Could you take a crack at getting some of these test failures sorted?

@therabidbanana

I'll take a look. Looks like a pretty stupid bug looking through the failures - I think earlier versions of ruby treat ?char format as an integer value instead of a single character string. I should have looked that up before using it to save a few characters.

@mnot

FYI, we're collecting tests at https://github.com/uri-templates/uritemplate-test - pull requests welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment