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

Andrea Cosentino commented on CAMEL-22985:
------------------------------------------

Give this route 

{code:java}
  - route:
      from:
        uri: timer:yaml
        steps:
          - setCheese:
              simple: Hello
{code}

You can now do something like


{code:java}
❯ Look at ../camel-jbang-examples/example.yaml and validate the yaml            
                                                                                
                                                                         
                                                                                
                                                                                
                                                                       
● Read 1 file (ctrl+o to expand)                                                
                                                                                
                                                                       
                                                                                
                                                                                
                                                                       
● Now let me validate this YAML DSL route.                                      
                                                                                
                                                                       
                                                                                
                                                                                
                                                                     
● camel - camel_validate_yaml_dsl (MCP)(route: "- route:\n    from:\n      uri: 
timer:yaml\n      steps:\n        - setCheese:\n            simple: Hello")     
                                                                       
  ⎿  {                                                                          
                                                                                
                                                                       
       "valid": false,                                                          
                                                                                
                                                                       
       "numberOfErrors": 1,                                                     
                                                                                
                                                                       
     … +9 lines (ctrl+o to expand)                                              
                                                                                
                                                                       
                                                                                
                                                                                
                                                                       
● The route is invalid. There is 1 error:                                       
                                                                                
                                                                       
                                                                                
                                                                                
                                                                       
  - setCheese is not a valid Camel EIP/processor — at /0/route/from/steps/0, 
the property setCheese is not recognized. The schema does not allow additional 
properties in a step definition.                                           
                                                                                
                                                                                
                                                                       
  It looks like the intended step might be setBody or setHeader. For example, 
to set the message body:                                                        
                                                                         
                                                                                
                                                                                
                                                                       
  - route:                                                                      
                                                                                
                                                                       
      from:                                                                     
                                                                                
                                                                       
        uri: timer:yaml                                                         
                                                                                
                                                                       
        steps:
          - setBody:
              simple: Hello

  Or to set a header named "cheese":

  - route:
      from:
        uri: timer:yaml
        steps:
          - setHeader:
              name: cheese
              simple: Hello
{code}




> camel-jbang-mcp - Add tool for yaml-dsl-validator
> -------------------------------------------------
>
>                 Key: CAMEL-22985
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22985
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Andrea Cosentino
>            Priority: Minor
>
> You can use the camel-yaml-dsl-validator to validate YAML DSL route files 
> agains the schema and get validator errors back. The tool can then return 
> this to the AI and the result can be in a json format so the AI has more 
> details.
>  
> See
> https://github.com/apache/camel/tree/main/dsl/camel-yaml-dsl/camel-yaml-dsl-validator



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

Reply via email to