[ 
https://issues.apache.org/jira/browse/CAMEL-21535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17905097#comment-17905097
 ] 

Raymond commented on CAMEL-21535:
---------------------------------

Just for reference:

In Assimbly we have a validator package:

[https://github.com/assimbly/runtime/tree/develop/dil/src/main/java/org/assimbly/dil/validation]

This also include a script validator class. This is used in a low-code platform 
Dovetail:

[https://academy.dovetail.world/docs/components/construction/script#example-of-script-evaluation]


A side note:

In general, the script validator works fine for us, but we do miss the line 
number on the errors. So that would be a good gain. Also, in some rare cases 
the script is validated correctly, but fails in a real route. For example, this 
line:


{code:java}
GString host = “${serviceName}.${region}.amazonaws.com”{code}

This code validated correctly, but failed when setting the host variable to a 
header with a Groovy script in a route.

 

This probably is because the validation method used implicitly a toString() 
method on the GString object in the header, while when running in a route 
(using direct as transport) the object stays as is, and was then represented as 
'json' in the tracing. When putting a ActiveMQ queue after the script, it 
worked, because probably there also a toString() kind of conversion is done.

Then I got the feedback from users: "your validation is not trustable, because 
there is a difference between validating and real usage of the script." So it's 
good to check/test if output of the validation is exactly the same as the 
output of running the script in a route.

> camel-groovy - Make it easier for low-code to validate scripts
> --------------------------------------------------------------
>
>                 Key: CAMEL-21535
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21535
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-groovy
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.10.0
>
>
> The Camel tool needs a bit easier way to validate that groovy scripts (and 
> potential others) can be quickly validated - there is some APIs in 
> camel-catalog but it does not fit as well to groovy as lack of camel context 
> being present, and also lack of more precise line number error reporting.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to