You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
Interger as name of Type produces a ClassCastException during parsing #679
When I attempt to parse a RAML definition that contains a type where its name is an Integer it failed. A ClassCastException is thrown.
I try to fix that by patch the source code of TypeDeclaration.java. It works but after a few search in the source code this error could be produced at many places.
So my question is more: is it allowed to use Integer as key of a type (or another resource)?
And if not, how to handle this error more cleanly? For example, to indicate that the RAML definition is invalid.
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.raml.yagi.framework.model.ModelProxyBuilder$SimpleProxy.fromMethod(ModelProxyBuilder.java:98)
at org.raml.yagi.framework.model.ModelProxyBuilder$SimpleProxy.invoke(ModelProxyBuilder.java:74)
... 38 more
Caused by: java.lang.ClassCastException: class org.raml.yagi.framework.nodes.snakeyaml.SYIntegerNode cannot be cast to class org.raml.yagi.framework.nodes.StringNode (org.raml.yagi.framework.nodes.snakeyaml.SYIntegerNode and org.raml.yagi.framework.nodes.StringNode are in unnamed module of loader 'app')
at org.raml.v2.internal.impl.commons.model.type.TypeDeclaration.name(TypeDeclaration.java:99)
... 44 more
This seems related to the way the underlying YAML parser handles keys in general. See this issue.
Feel free to submit a PR with a few test cases if this is something you really need to be addressed.
Otherwise, note that this parser is deprecated in favor of webapi-parser, which should behave as expected.
Activity
jstoiko commentedon Jan 7, 2020
This seems related to the way the underlying YAML parser handles keys in general. See this issue.
Feel free to submit a PR with a few test cases if this is something you really need to be addressed.
Otherwise, note that this parser is deprecated in favor of
webapi-parser, which should behave as expected.