drafter: New style parameter breaking when using backtick

I originally posted this in the aglio repo, but apparently it’s caused by the drafter code, not the aglio, so thought I’d ask in here if drafter was where the bug was. Thanks.

I’ve noticed an issue when there are underscores as part of the params in the resources.

Here’s an example:

FORMAT: 1A

# Test Doc

# Group Tests

# Test endpoint [/test{?status,order_by,sort,page,per_page}]

+ Parameters
    + status: paid (optional, string) - some test status
    + order_by: transaction_date (optional, enum) - one of transaction_date, merchant_network_name, amount, user_commission, status
    + sort: asc (optional, enum) - one of asc, desc
    + page: 1 (optional, integer) - pagination parameter
    + per_page: 5 (optional, integer) - pagination parameter

### Fetch some data [GET]

+ Response 204

When running aglio against the above with the following command "./node_modules/aglio/bin/aglio.js --theme-style default -i test.apib -o test.html" then I get the following warning:

>> Line 9: parameter 'order_by: transaction_date' not specified in 'Test endpoint' its '/test{?status,order_by,sort,page,per_page}' URI template (warning code 8)

And the generated html looks like:

screen shot 2015-09-25 at 12 01 13 copy

I’ve noticed if I remove all the underscores in the examples, it works as expected, so must be an issue with the way it handles underscores in the parameters.

My aglio version is: aglio 2.0.4 olio 1.2.1

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 25 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@earnaway You can use homebrew to install the latest drafter 3.2.x. The command is follows:

brew install --HEAD https://raw.github.com/apiaryio/drafter/master/tools/homebrew/drafter.rb