danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 480 forks source link

Hyphen not allowed in expressions #134

Closed tciuro closed 9 years ago

tciuro commented 9 years ago

I have the following section:

## Some Section [/things/{id}/actions/{non-fatal|with-results}]

Terminal shows the following warning:

>> Line 141: URI template expression "non-fatal|with-build-results" contains hyphens.
Allowed characters for expressions are A-Z a-z 0-9 _ and percent encoded characters
(warning code 12)

Why can't an expression contain an hyphen? Replacing them with an underscore looks uglier:

## Some Section [/things/{id}/actions/{non_fatal|with_results}]

Is there a reason for this, or just an oversight? Thanks.

danielgtaylor commented 9 years ago

@tciuro the URI template RFC disallows certain characters. These must be %-encoded. You can try using non%2Dfatal instead, and Aglio 2.0+ should render the - properly.

tciuro commented 9 years ago

@danielgtaylor it works... kind of:

1) the hyphen encoded as %2D works well 2) The following doesn't show properly well in agile 2.0 (it used to be displayed fine):

## Selection [/things/{id}/actions/{non%2Dfatal|with%2Dresults}]

Question: how would I specify the different parameters allows in a query string so aglio renders it properly?

tciuro commented 9 years ago

Also, what happened to the method URI rendering? Before it was colored and not it's bold (rather ugly). Is there a setting I should specify to get the former behavior? Thanks.

danielgtaylor commented 9 years ago

@tciuro parameters defined in the URI template will only show if there is an appropriate parameter defined for the resource or action. For example:

# My resource [/things/{id}{?count}]
+ Parameters
  + id (required) - some description
  + count (number) - optional parameter count

It looks like there my be a bug in the filtering when %-encoded names are used, which I'll investigate. Thanks for pointing out that the URIs are now bold on some browsers - I'll fix that as well.