apiaryio / api-blueprint

API Blueprint
https://apiblueprint.org
MIT License
8.64k stars 2.14k forks source link

Escape special characters in Array data structure #285

Closed romainPellerin closed 8 years ago

romainPellerin commented 8 years ago

Hi Apiary team,

first, my strong congrats for all the work around API Blueprint and hosting!

I experience a new issue since a few days on the rendering (right panel of apiary.io) for this kind of data structure:

## Credentials (object)
+ uid: e35be76-rfc9-45d3-8783-731d66b18f48 (string, required) - id of the user

This is parsed by your engine as:

ATTRIBUTES

name     value           description
uid      e35bed76        rfc9-45d3-8783-731d66b18f48 (string, required) - id of the user

So it takes the first "-" as the delimiter of attribute's description. Hope you can fix this asap for a better readability on your API hosting.

Best.

pksunkara commented 8 years ago

Hey, you need to escape the value with backticks since - is a reserved character.

`e35be76-rfc9-45d3-8783-731d66b18f48`
romainPellerin commented 8 years ago

Thanks it works. Is it a new requirement? In fact, this was not mandatory a few days ago.

kylef commented 8 years ago

@romainPellerin It's always been apart of the API Blueprint and MSON specification, however tooling may have allowed this though previously.

Without this there is really no way to determine where the description separator is in the following example:

## Credentials (object)
+ uid: e35be76-rfc9-45d3-8783-731d66b18f48 (string, required) - id of the user-name
romainPellerin commented 8 years ago

Yes it works but the CURL command generated keeps the character ` and then modifies the content expected for the request:

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --data-binary "[\"uid: `e35be76-rfc9-45d3-8783-731d66b18f48`\"]" \
'http://host/api/service'
pksunkara commented 8 years ago

Unfortunately, I cannot reproduce this. Please look at docs.mson.apiary.io.

I am getting the following:

curl --include \
     --request GET \
     --header "Content-Type: application/json" \
     --data-binary "[{\"id\":\"abcd-efgh\"}]" \
'http://private-2a15-mson.apiary-mock.com/user'