jdiegodcp / ramlfications

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

Corrected processing of reserved parameter <<resourcePathName>> #92

Closed bpowell65536 closed 8 years ago

bpowell65536 commented 8 years ago

The parameters section of the RAML 0.8 spec states that the <<resourcePathName>> reserved parameter should be populated with the section of the resource path after the right-most '/' character. Currently ramlfications populates the <<resourcePathName>> parameter with the section of the resource path after the left-most '/' character. This change corrects this behaviour.

codecov-io commented 8 years ago

Current coverage is 96.93%

Branch #92 has no coverage reports uploaded yet.

Powered by Codecov. Updated on successful CI builds.

econchick commented 8 years ago

Question: is resourcePathName supposed to be the last bit of the path, (eg /{id}) or the "full" path (eg /users/{id})?

bpowell65536 commented 8 years ago

@econchick The RAML 0.8 spec says:

In resource type definitions, there are two reserved parameter names: resourcePath and resourcePathName. The processing application MUST set the values of these reserved parameters to the inheriting resource's path (for example, "/users") and the part of the path following the rightmost "/" (for example, "users"), respectively."

To answer your question: It looks like resourcePathName is supposed to be the last part of the path, but without any leading '/' character (i.e. path.split("/")[-1]). The full path (including all the '/' characters) is provided as well, as the resourcePath parameter.

econchick commented 8 years ago

@bpowell65536 I did read that, but it's unclear in the spec's example if /users is a root-level defined resource or a child resource, if that makes sense.

bpowell65536 commented 8 years ago

The example is ambiguous in that regard, but given that resourcePathName is

the part of the path following the rightmost "/"

does it matter if the resource is a root-level resource or a child resource? The example says "/users" resolves to "users", but wouldn't "/root/users" also resolve to "users"?

econchick commented 8 years ago

Nope, you're right - I am just an idiot :D

econchick commented 8 years ago

Before I merge this, could you rebase on v0.2.0-dev to fix the merge conflicts?

bpowell65536 commented 8 years ago

@econchick Great, I was hoping I hadn't really screwed up my reading of the spec there :P I'll rebase this from v0.2.0-dev now.

econchick commented 8 years ago

Thanks!