Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New style parameter breaking when using backtick #123

Closed
earnaway opened this issue Sep 25, 2015 · 25 comments
Closed

New style parameter breaking when using backtick #123

earnaway opened this issue Sep 25, 2015 · 25 comments
Labels

Comments

@earnaway
Copy link

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

@earnaway
Copy link
Author

To follow up from the above, if I run the command:
./drafter/bin/drafter test.apib on the above .apib file, the JSON returns the following (only showing the relevant issue):

{
  "name": "order_by: transaction_date",
  "description": "one of transaction_date, merchant_network_name, amount, user_commission, status",
  "type": "enum",
  "required": false,
  "default": "",
  "example": "",
  "values": []
},

with a warning:

"warnings": [
  {
    "code": 8,
    "message": "parameter 'order_by: transaction_date' not specified in 'Test endpoint' its '/test{?status,order_by,sort,page,per_page}' URI template",
    "location": [
      {
        "index": 101,
        "length": 373
      }
    ]
  }
],

The "name" should be "order_by" without the ": transaction_date". If I remove all the underscores it works as expected.

@pksunkara
Copy link
Contributor

_ is a special character in MSON. So, please enclose order_by within ```. order_by

@earnaway
Copy link
Author

When trying it with the following changes:

+ 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

I get the following warning:

"warnings": [
    {
      "code": 5,
      "message": "ignoring unrecognized block",
      "location": [
        {
          "index": 175,
          "length": 130
        }
      ]
    }
  ],

@pksunkara
Copy link
Contributor

Can you please give us the complete blueprint?

@earnaway
Copy link
Author

I'm testing the underscores, and using this blueprint:

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

which results in an output with warnings here:
https://gist.github.com/earnaway/acc2e37b4c266411fe55

My command:
./node_modules/drafter/bin/drafter test.apib

@earnaway
Copy link
Author

Hi, just wondering if you could replicate that above using that blueprint I provided?

@pksunkara
Copy link
Contributor

@earnaway Looks like this is a bug on our side. The ``` are affecting the new style parameter recognition somehow.

@pksunkara pksunkara reopened this Sep 28, 2015
@pksunkara pksunkara added bug and removed question labels Sep 28, 2015
@pksunkara pksunkara changed the title Request parameters breaking when examples and copy has underscores New style parameter breaking when using backpack Sep 28, 2015
@pksunkara pksunkara changed the title New style parameter breaking when using backpack New style parameter breaking when using backtick Sep 28, 2015
@earnaway
Copy link
Author

earnaway commented Oct 1, 2015

Any idea if this is on the radar to update and fix fairly soon? Or just a rough ETA on it if you have an idea? Thanks.

@earnaway
Copy link
Author

Hi @pksunkara - just wondering if there was any recent update to this with the ``` issue? Thanks!

@kylef
Copy link
Member

kylef commented Oct 15, 2015

Hi @earnaway, we don't have any updates yet. But this is on our radar, we have some a couple of regression issues which we need to tackle first before getting to this one. We'll be sure to update this issue when we get to working on this.

@earnaway
Copy link
Author

Thanks @kylef

@claravanstaden
Copy link

Any time estimate on this?

@pksunkara
Copy link
Contributor

@Clar64 Unfortunately, we are currently working very hard on getting MSON and Attributes out. Once that is done, this bug is very high on our priority list and we would love to fix this as soon as possible.

@claravanstaden
Copy link

Thanks, we appreciate it!

On Fri, 20 Nov 2015 16:38 Pavan Kumar Sunkara notifications@github.com
wrote:

@Clar64 https://github.com/Clar64 Unfortunately, we are currently
working very hard on getting MSON and Attributes out. Once that is done,
this bug is very high on our priority list and we would love to fix this as
soon as possible.


Reply to this email directly or view it on GitHub
#123 (comment).

@truebit
Copy link

truebit commented Jan 22, 2016

Any update on this? This issue is too annoying to make other guys in the team believing in api-blueprint...

@bennettellis
Copy link

ditto

@pksunkara
Copy link
Contributor

This has now been fixed in parser master branch. We will be incorporating it in Apiary soon.

@bennettellis
Copy link

Awesome. Thank you!!

@earnaway
Copy link
Author

Excellent! Thank you 👍

@truebit
Copy link

truebit commented Feb 25, 2016

Any update?

@pksunkara
Copy link
Contributor

Unfortunately, this is not yet deployed. We will update you as soon as it is.

@kylef
Copy link
Member

kylef commented Mar 18, 2016

This bug was resolved in Drafter 2.3.0-pre.0, and it has been rolled out to Apiary providing you are behind the Attributes Kit feature flag.

@earnaway
Copy link
Author

earnaway commented Jan 6, 2017

What would be the best/easiest way to install Drafter 2.3.0-pre.0 - I'm only on drafter 1.2.0 but would like to try get 2.3.0-pre.0.
Thanks

@pksunkara
Copy link
Contributor

@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

kylef pushed a commit that referenced this issue Jul 7, 2017
@kamihouse
Copy link

Guys we can do this:

+ Parameters
     + `grant_type`: `refresh_token` (string, required) - Tipo de concessão

Works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants