Open alvassin opened 6 years ago
Moreover, in official parser i can create very stupid declarations, like the following:
#%RAML 1.0
title: multiInheritance
types:
WTFIsThat:
type: [string, (number | array)]
Is that ok and the result should be Derived[String, Union] type, which allows ancestors of the different type?
From my point of view, if we are inheriting from Union type, parser must validate Union contents.
According to documentation, there is two notations for type declaration:
[]
brackets[]
brackets, but may be wrapped with type expression brackets()
).1. Should parsers allow to mix two notations? Documentations does not say that you should use only one. (I can't do that in raml-js-parser2, it that a bug of parser?)
2. Is it allowed to create [string, nil] multiple inheritance? In raml-js-parser it is allowed. But it does not match documetation, right?
Multiple inheritance notation allows to use union symbol
|
and commas,
. raml-js-parser2 also allows to use()
brackets to group expressions (but only for some cases).[]
modificator can not be used to declare arrays.General notation allows
[]
symbols for modifying types as arrays, '()' symbols are allowed for grouping (nested too) in any imaginary cases. Multiple inheritance using comma or '[]' brackets is not supported.