Closed econchick closed 8 years ago
This should be all set in the v0.2.0-dev branch :tada:
@econchick Sorry to resurrect this, but I think I have found a case where the substitution of parameters doesn't work - given the following RAML:
#%RAML 0.8
title: Parameterised Resource Test
version: v1
baseUri: http://localhost:8080
resourceTypes:
- collection-custom-variable:
get:
description: Get all the <<resourceType|!pluralize>>
put:
description: Create a new <<resourceType>>
patch:
description: Update an existing <<resourceType>>
delete:
description: Delete an existing <<resourceType>>
/jobs:
type:
collection-custom-variable:
resourceType: job
/units:
type:
collection-custom-variable:
resourceType: unit
/users:
type:
collection-custom-variable:
resourceType: user
the resourceType
parameter is not substituted into any of the method descriptions (this example doesn't work at all on the v0.2.0-dev branch because of a mistake I made in the fix for #85 - the attempted fix for the issue described here corrects that mistake as well). I have tried to develop a fix for this, but I ended up reimplementing some of the existing parameter substitution code. I would prefer to re-use the existing code if possible, but I'm not sure how to integrate it with the ramlfications.parser.main._create_resource_node
method, which is where I think the substitution code needs to be. I have pushed a test case and a partial fix (which doesn't handle parameter transforms) to https://github.com/bpowell65536/ramlfications/tree/parameterised_resources_fix - would you be able to take a look? Thanks!
@econchick After a bit more thought, I have made a better fix for this issue using ramlfications.utils.common.substitute_parameters
. This fix handles parameter transforms and passes all the existing test cases, including correctly parsing the example in the previous post. I can post a pull request now if you like.
Within RAML, one is able to declare parameters within resource types and traits docs. It would be nice when accessing the actual resource object defined with a resource type/trait containing a parameter, to have the parameter values substitute the
<<parameter>>
.Currently, it's setup as follows:
And ideally, it'd look like this: