How can I define array of enums in API blueprint
Asked Answered
C

1

6

My supposed solution for parameters section is

+ fields: [firstField, secondField] (array[enum], optional)
  + Members
      + firstField
      + secondField
      + extraField
      + dummyField

But it failed on semantic error:

The example value [firstField, secondField] of parameter fields is not in its list of expected values

Consciencestricken answered 7/9, 2015 at 14:36 Comment(0)
U
8

I tried to understand your needs and wish for syntax of your API Blueprint.

One of possible solutions in MSON syntax as I see it is probably down below:

- fields (array, optional)
    - (enum)
        - firstField
        - secondField
        - extraField
        - dummyField

Hope it helps and solves your Array of Enum thing.

Unborn answered 27/1, 2016 at 15:37 Comment(2)
This does not work for Parameters, only for Attributes. It seems like the most you can do is specify array[string] as the type, not nest it this much.Unconnected
Yes. Parameters are meant to be used for URI Template (Resource URL) definitions.Unborn

© 2022 - 2024 — McMap. All rights reserved.