raml-spec
raml-spec copied to clipboard
Clarify enum values
I'm a bit confused by what can go into elements of enum
property. One one hand, there is description:
An enumeration of all the possible values of instances of this type. The value is an array containing representations of these possible values; an instance of this type MUST be equal to one of these values.
But, in the union example, it's a bit more crazy:
when the type is nil | number you may use enum: [ 1, 2, ~ ] or more explicitly/verbosely enum: [ 1, 2, !!null "" ];
It's unclear (to me), what are these special constructs of ~
, or !!null
are, or what are all such constructs that can go under enum elements, and what do they represent.
It's part of the YAML syntax, see: http://yaml.org/type/null.html.
Thank you for the reference. Then does this mean that the enum elements can be regexes? I'm not sure whether ~
is "canonical" null, or "regex" null...