Array that can only contain the given types in MSON

166 Views Asked by At

How do I specify in MSON that an array should only contain types A, B or C, and not any other types?

I've tried

+ myField (array[A], fixed-type, required)

but the JSON schema generated by aglio only requires the first element of the array to be of type A.

1

There are 1 best solutions below

0
On

The fixed-type feature of MSON is relatively new. If you've had Aglio installed for a while, you are probably using an older version of the parser. You can uninstall/reinstall it and see if it'll pick up the latest version of the protagonist library (which includes the feature), or you can install from Github which supports the new drafter library and should see a release soon. One of the big benefits there is that it no longer requires a compiler to install.