Api-blueprint: Response with array of MSON objects

Created on 29 Jul 2015  路  4Comments  路  Source: apiaryio/api-blueprint

I have Event data structure, and have GET Events method

## Event (object)
+ eventId : 1 (number, required)  Id of event
+ name: Albuquerque Balloon Fiesta (string, required) Name of event
+ location: Albuquerque, NM (string, required) Location of event
...

### List All Events [GET /events]

+ Response 200 (application/json)

    + Attributes
        + events (array[Event])

Apiary will generate method documentation with one event in the response json. I'm wondering how I can hook Apiary to generate 10 events in the response. It would be very useful feature in order to make Mock server much closer to real implementation.

Question

Most helpful comment

You don't necessarily need to create 10 events, instead you could reference the same one multiple times:

## Events [/events]
### View [GET]

+ Response 200 (application/json)
    + Attributes (array)
        + (Event)
        + (Event)
            + name: Katie
        + (Event)

## Data Structures
### Event (object)
+ name: Kyle (string)

All 4 comments

@AlexKorovyansky I agree with you. Until then you can workaround it by creating 10 data structures named Event1 ... Event10 and use them.

You don't necessarily need to create 10 events, instead you could reference the same one multiple times:

## Events [/events]
### View [GET]

+ Response 200 (application/json)
    + Attributes (array)
        + (Event)
        + (Event)
            + name: Katie
        + (Event)

## Data Structures
### Event (object)
+ name: Kyle (string)

Thanks guys!

You don't necessarily need to create 10 events, instead you could reference the same one multiple times:

## Events [/events]
### View [GET]

+ Response 200 (application/json)
    + Attributes (array)
        + (Event)
        + (Event)
            + name: Katie
        + (Event)

## Data Structures
### Event (object)
+ name: Kyle (string)

I dont know how many times I tried to find out how I am supposed to do it exactly this way - to have an example for more than one entry in an array. Just a defined array with multiple examples in Blueprint. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

annappropriate picture annappropriate  路  5Comments

fgblomqvist picture fgblomqvist  路  3Comments

bazo picture bazo  路  8Comments

danilvalov picture danilvalov  路  3Comments

spark-developer picture spark-developer  路  12Comments