I want to define an optional size
object. If the object is present, there should be at least one of the specified properies (min
or max
) given. I though of something like this:
properties:
someval:
type: string
size:
type: object
required: false
additionalProperties: false
minProperties: 1
properties:
min:
required: false
type: string
max:
required: false
type: string
But it seems that minProperies
implies that the size
must be available. At least I get this validation error if I only set min or max:
<pre>TypeError: Cannot convert undefined or null to object<br> at Function.keys (<anonymous>)<br> at MinProperties.extractValue (C:\mypath\node_modules\raml-typesystem\dist\src\restrictions.js:1059:23)<br> at MinProperties.MinMaxRestriction.check (C:\mypath\node_modules\raml-typesystem\dist\src\restrictions.js:775:22)<br> at C:\mypath\node_modules\raml-typesystem\dist\src\typesystem.js:1564:89<br> at Array.forEach (<anonymous>)<br> at InheritedType.AbstractType.validateDirect (C:\mypath\node_modules\raml-typesystem\dist\src\typesystem.js:1564:37)<br> at InheritedType.AbstractType.validate (C:\mypath\node_modules\raml-typesystem\dist\src\typesystem.js:1612:34)<br> at C:\mypath\node_modules\raml-validate\raml-validate.js:308:31<br> at C:\mypath\node_modules\raml-validate\raml-validate.js:405:18<br> at Array.map (<anonymous>)</pre>
How can I achieve the initial specification without working with an always set size
object?