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 has been archived by the owner on Feb 12, 2022. It is now read-only.
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
The text was updated successfully, but these errors were encountered:
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.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Attempt to fix the issue
I try to fix that by patch the source code of
TypeDeclaration.java
as below:Error information
RAML Content
Error stack trace
The text was updated successfully, but these errors were encountered: