Search code examples
apiblueprintaglio

Aglio Render Markdown after Request / Response section


Here's a snippet of my apib document. Essentially, I want to be able to put additional descriptive information after the Request and Response sections, however this information is not rendered. Instead any further text under a new heading is interpreted as part of the response 200 section. I would like to be able to put a table in the Errors section, so this data would ideally be markdown rendered. Is this possible with aglio? Thanks!

#### Rate Limiting

This endpoint allows 20 requests per hour.

+ Request (application/json)
    + Attributes (object)
        + id (number)

+ Response 200 (application/json)
    + Attributes (object)
        + status: success (string)

### Errors

Table of error codes

Solution

  • Cameron, this is only currently possible within the description section before the request/response pairs. For example:

    ## My Resource [/foo]
    
    ### My Action [GET]
    
    #### Rate Limiting
    
    This endpoint allows 20 requests per hour.
    
    #### Errors
    
    Table of error codes
    
    + Request (application/json)
        + Attributes (object)
            + id (number)
    
    + Response 200 (application/json)
        + Attributes (object)
            + status: success (string)
    

    Alternatively, you could hard code this sort of information in a custom template which would give you full control over what goes where. The reason I say "hard code" is because the API Blueprint parser is seeing your text as belonging to the response rather than the action or example, and I can't modify that behavior within Aglio. You could open a ticket on the upstream API Blueprint repository to request such a feature or use the workaround above.

    One last note - you can describe 400 and 500 level responses as request/response pairs. Since the request/response pairs are rendered in the order given in the document you can ensure the error examples show up last.