jdiegodcp / ramlfications

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

URI parameters missing if not listed in uriParameters property #56

Closed matiasb closed 8 years ago

matiasb commented 8 years ago

According to spec [1], URI parameters are defined by parametrizing the path and the use of uriParameters property is optional. However, ramlfications won't list a URI parameter unless it is listed in the uriParameters property:

>>> import ramlfications
>>> RAML = """
... #%RAML 0.8
... /something/{name}:
...     get:
... """
>>> loader = ramlfications.loads(RAML)
>>> config = setup_config(None)
>>> raml_obj = ramlfications.parse_raml(loader, config)
>>> raml_obj.resources[0].uri_params
>>> 

but

>>> import ramlfications
>>> RAML = """
... #%RAML 0.8
... /something/{name}:
...    uriParameters:
...         name:
...     get:
... """
>>> loader = ramlfications.loads(RAML)
>>> config = setup_config(None)
>>> raml_obj = ramlfications.parse_raml(loader, config)
>>> raml_obj.resources[0].uri_params
[URIParameter(name='name')]
>>> 

[1] http://raml.org/spec.html#uri-parameters

econchick commented 8 years ago

Ah thank you for reporting - I'll take a look into this. I do agree that actually defining uriParameters is optional.

econchick commented 8 years ago

Fixed in #75 (hopefully!)