raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Type string[][]

Open KevinMitchell opened this issue 7 years ago • 0 comments

Although the RAML spec allows arrays of arrays it looks like the model built by the parser has problems handling them. Rather than perhaps the more conventional approach of a base type for instances, with objects, arrays and scalars being subtypes, the RAML model seems more constrained. So given a TypeInstanceProperty we can determine than we have an array instance. But if we index into the values we get back instances of TypeInstance. In the case of an array of arrays this TypeInstance will presumably be an array instance. But at this point we then get stuck if we try to access the inner array. Calling value() returns null, and calling properties() returns:

Exception in thread "main" java.lang.RuntimeException: Internal error while trying to call public abstract java.util.List<org.raml.v2.api.model.v10.datamodel.TypeInstanceProperty> org.raml.v2.api.model.v10.datamodel.TypeInstance.properties()
            at org.raml.yagi.framework.model.ModelProxyBuilder$SimpleProxy.invoke(ModelProxyBuilder.java:79)
            at com.sun.proxy.$Proxy27.properties(Unknown Source)

But the root cause feels more like a problem in the model itself as it's more restrictive than the language it's trying to model.

Suggestions?

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-91

KevinMitchell avatar May 22 '17 08:05 KevinMitchell