2

we're struggling describing an array of any size in our API. Using API Blueprint and MSON format for Dredd testing.

Endpoint /spots should return an array of "Spots" (those are objects). We don't know how many though. Currently we have only been able to make dredd validate the first spot of our array. Here is our blueprint :

FORMAT: 1A
HOST: http://host.com/

# Our API

## Spots [/spots{?type}]

### List All Spots [GET]
+ Parameters
    + type (optional, string) - a filter on the spot type

+ Response 200 (application/json)

    + Attributes (array)
        - (Spot)

# Data Structures

## Spot(object, fixed-type)

- name: `Spot name` (string)
- code : `SPOT1` (string, required)
- type: `spotType` (string)

## Spots(array, fixed-type)
    - Spot

If we remove fixed-type in ## Spots(array, fixed-type) then nothing is validated at all...

We need to tell him that all elements of Spots must be Spot but without restriction on how many there is.

Thanks for your help!

vicdup
  • 151
  • 5

2 Answers2

1

You can try something like this.

## Spots (array[Spot], fixed-type)

Thanks.

Pavan Kumar Sunkara
  • 3,025
  • 21
  • 30
  • It yields the same result, dredd is waiting for an array with exactly one Spot, my first spot is ok but then all the other one are not accepted. Thanks for your time – vicdup Aug 09 '17 at 14:59
0

It looks like it is a bug in Dredd: https://github.com/apiaryio/dredd/issues/177

Honza Javorek
  • 8,566
  • 8
  • 47
  • 66