Declaring array fails, bug?
alvassin opened this issue · comments
This is ok:
MyType: array -> any[]
MyType: [] -> any[]
MyType: any[] -> any[]
This is ok too:
MyType: string | array -> union[str, any[]]
MyType: string | any[] -> union[str, any[]]
This fails. Why? Is that a bug?
MyType: string | []
Hi @alvassin !
In fact, MyType: [] -> any[]
is not ok. The parser must produce an error for this case.
Thanks for your reports.
Hi @alvassin !
Actually, I can not reproduce the case of MyType: []
being interprited as any[]
. Could you, please, post an example? According to what I see, ``MyType: []is interproted as a multiple inheritance case with zero supertys and, thus, default type (which is
string` for top level types) is set to `MyType`. This behavior is natural as the RAML 1.0 spec does not prohibit using zero supertypes in a multiple inheritance case.
Regards,
Konstantin
Closing for now as no answers. Feel free to provide more information and re-open if this is still relevant.
Also note that raml-js-parser-2 has been deprecated, the new official parser is webapi-parser. Feel free to attempt to reproduce this issue with webapi-parser and report any issue you may have on that repository.