danielgtaylor / aglio

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

URI Parameter section able to use MSON enum #286

Closed albinpoignot closed 8 years ago

albinpoignot commented 8 years ago

The URI Parameters section works perfectly well with an enum and allows to describe the default and possible values in the Members section.

However, in my case, the possible values are exactly the same as in the response, which is formatted in MSON. It would be really great if I could avoid to maintain two separated lists.

An example is sometimes (everytime ?) better than an explication - it is simplified for clarity, by the way ;)

# Get all entities [GET /rentals{?status}]

Get all entities

+ Parameters
    + status: `IN_PROGRESS` (enum[string], optional) - Status of rentals

        + Members
          + PENDING
          + IN_PROGRESS
          + CLOSED

+ Response 200

    + Attributes (array[Entity])

# Data Structures

# Status (enum)
+ PENDING
+ IN_PROGRESS
+ CLOSED

## Entity
+ status: (Status, required)
+ duration: 0 (number, optional)
+ distance: 0 (number, optional)

As you could see, the list in Members section and in the Status enum description is exactly the same (and will always be).

Everything works perfectly as is, but I will always have to maintain two lists which are exactly the same.

kylef commented 8 years ago

Hi @albinpoignot,

I think this is a question regarding the API Blueprint language and not Aglio specifically. I think what you are looking for is using MSON in parameters, if that's true check out https://github.com/apiaryio/api-blueprint-rfcs/pull/3 the proposal on the API Blueprint language to be able to use MSON with the parameters section. It's already on the API Blueprint roadmap.

albinpoignot commented 8 years ago

Hi @kylef.

You are perfectly right. I am sorry for the inconvenience :(

Anyway, great news about the RFC. I obviously didn't see it :) Looking forward to this feature in the real world :)

I will close this issue : as stated, it's an API Blueprint issue.