KaotoIO / kaoto

The UI of the Kaoto project
https://kaoto.io
Apache License 2.0
36 stars 28 forks source link

Wrong parsing of Camel uri when a path parameter is not required and not provided #654

Closed apupier closed 9 months ago

apupier commented 9 months ago

Describe the Bug

Destinationname of jms example is not displayed in config form

Steps to Reproduce the Bug or Issue

  1. Load xample from https://github.com/apache/camel-kamelets-examples/blob/030729ee7e32cb01e5388783b8cf81b8b1a0ee78/jbang/artemis/consumer.yaml :
    
    # camel-k: language=yaml

Write your routes here, for example:

Screenshots or Videos

No response

Platform

Kaoto online

apupier commented 9 months ago

when providing a vbalue for the destinationName, we can notice that the destinationName was mistaken with the destinationType:

- route:
    id: route-1658
    from:
      uri: jms
      parameters:
        destinationName: providedFromUI
        destinationType: cheese
      steps:
        - log: ${body}
lordrip commented 9 months ago

This is the syntax of the JMS component:

    "syntax": "jms:destinationType:destinationName",

In the original URI uri: "jms:cheese", cheese is considered the destinationType, and after that, through the UI, setting the destinationName goes to the destinationName property.

@apupier could it be possible the example to miss an additional path parameter?

apupier commented 9 months ago

in fact the destinationType is optional based on documentation https://camel.apache.org/components/4.0.x/jms-component.html#_uri_format

jms:[queue:|topic:]destinationName[?options]

so means that we have to read also the required flag for the component path property https://github.com/apache/camel/blob/5670146748c17703b52ec4d51e2c9e175864eeb1/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jms.json#L146

apupier commented 9 months ago

it is affecting also at least activemq and amq

lordrip commented 9 months ago

I hope that queue is an invalid topic name, otherwise, this might be confusing 😅

igarashitm commented 9 months ago

I think queue and topic also are valid topic/queue name unfortunately, so for this one if the path part has just 1 part, it needs to assume it to be a destinationName where queue/topic is optional and destinationName is mandatory