raml-spec icon indicating copy to clipboard operation
raml-spec copied to clipboard

Clarify enum values

Open veselov opened this issue 6 years ago • 2 comments

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.

veselov avatar Jun 27 '18 23:06 veselov

It's part of the YAML syntax, see: http://yaml.org/type/null.html.

jstoiko avatar Jun 27 '18 23:06 jstoiko

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...

veselov avatar Jun 28 '18 00:06 veselov