jdiegodcp / ramlfications

Python parser for RAML
https://ramlfications.readthedocs.org
Apache License 2.0
234 stars 50 forks source link

parser: handle scheme-less uris #98

Closed buhman closed 1 year ago

buhman commented 8 years ago

This code seems to depend on .split('://') returning a 2-element sequence. This doesn't seem to be a valid assumption:

The baseUri property's value MUST conform to the URI specification [RFC2396] or a Level 1 Template URI as defined in RFC 6570

From my reading of RFC 6570, it seems stuff like: {endpoint}/api, where endpoint is something like http://foo, would be completely valid--or at least that isn't explicitly prohibited.

With such a baseUri, the current code would end up attempting a str + list concatenation, which is a TypeError.

I'm not sure of the best way to handle this--I also think logic like "if no uri scheme is present in the un-expanded template uri, the rest of this code will be invalid anyway, so just return uri" would be also valid.

Would you like a regression test for this as well?

codecov-io commented 8 years ago

Current coverage is 96.82%

Merging #98 into master will decrease coverage by -0.87% as of 44871c5

Powered by Codecov. Updated on successful CI builds.