apiaryio / api-blueprint

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

Type of array enums not validating #360

Closed Ramblurr closed 7 years ago

Ramblurr commented 7 years ago

If I have a query parameter line like so:

    + filter[documents][state][]: `['DRAFT', 'FINISHED]` (array[string], optional) - Find documents matching the states provided.
        + Members
            + DRAFT
            + IN_PROGRESS
            + CLOSED

Then drafter complains:

Warning: the example value '['DRAFT', 'FINISHED]' of parameter 'filter[documents][state][]' is not in its list of expected values

I can't find in the spec any mention of typed arrays like this. Is this a supported feature? What's the proper way to limit the types of an array?

pksunkara commented 7 years ago

@Ramblurr You have specified the type to be string, so the value becomes ['DRAFT', 'FINISHED'] as string (not an array). Since this value is not found in the list you gave, this is valid warning.

Ramblurr commented 7 years ago

Thanks @pksunkara What is the proper way to specify an array of strings, provide members, and an example?

pksunkara commented 7 years ago

You can try DRAFT, FINISHED instead of ['DRAFT', 'FINISHED']

kylef commented 7 years ago

@Ramblurr Did Pavan's suggestion solve your problem?