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
line 1:1 mismatched input '<EOF>' expecting {'[', '.', '..'}
org.openrewrite.internal.RecipeRunException: java.lang.ClassCastException: class org.antlr.v4.runtime.tree.TerminalNodeImpl cannot be cast to class org.openrewrite.json.internal.grammar.JsonPathParser$ExpressionContext (org.antlr.v4.runtime.tree.TerminalNodeImpl and org.openrewrite.json.internal.grammar.JsonPathParser$ExpressionContext are in unnamed module of loader 'app')
at org.openrewrite.TreeVisitor.visit(TreeVisitor.java:290)
[...]
Caused by: java.lang.ClassCastException: class org.antlr.v4.runtime.tree.TerminalNodeImpl cannot be cast to class org.openrewrite.json.internal.grammar.JsonPathParser$ExpressionContext (org.antlr.v4.runtime.tree.TerminalNodeImpl and org.openrewrite.json.internal.grammar.JsonPathParser$ExpressionContext are in unnamed module of loader 'app')
at org.openrewrite.json.JsonPathMatcher.find0(JsonPathMatcher.java:76)
at org.openrewrite.json.JsonPathMatcher.matches(JsonPathMatcher.java:86)
at org.openrewrite.json.JsonPathMatcherTest$2.visitLiteral(JsonPathMatcherTest.java:914)
at org.openrewrite.json.JsonPathMatcherTest$2.visitLiteral(JsonPathMatcherTest.java:864)
at org.openrewrite.json.tree.Json$Literal.acceptJson(Json.java:253)
at org.openrewrite.json.tree.Json.accept(Json.java:39)
at org.openrewrite.TreeVisitor.visit(TreeVisitor.java:250)
... 28 more
Broader context
JsonPath is used as an argument to multiple recipes for languages like JSON or YAML
AFAICT $ is a valid JsonPath expression to denote the root of the document and it should be supported
I can confirm this is also showing in the MergeYaml recipe -> was able to bypass the error by using $.. Strangely enough, when I run the tests that execute the MergeYaml directly, there it is working. (there are even existing tests)
When i run the tests that run a recipe that internally calls MergeYaml, it is not working with this exception.
What version of OpenRewrite are you using?
Current main (4684213)
Minimal example
The following test in
JsonPathMatcherTest
:fails with:
Broader context
$
is a valid JsonPath expression to denote the root of the document and it should be supportedrewrite/rewrite-json/src/test/java/org/openrewrite/json/AddKeyValueTest.java
Line 30 in bf0519d
$.
(which BTW I think is invalid JsonPath), if you put$
there you get the sameClassCastException
.The text was updated successfully, but these errors were encountered: