Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-19386

Support object property on template bean

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.0-RC1, 4.0.0
    • camel-yaml-dsl
    • None
    • Unknown

    Description

      The template bean, which is used by Kamelet, is out of sync between schema and deserializer/definition
      https://github.com/apache/camel/blob/main/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/RouteTemplateDefinitionDeserializer.java#L48
      https://github.com/apache/camel/blob/main/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/RouteTemplateDefinitionDeserializer.java#L88

      Note that the "RouteTemplateBeanDefinition" only allows key/value style with only string value allowed, no object properties.
      https://github.com/apache/camel/blob/main/core/camel-core-model/src/main/java/org/apache/camel/model/RouteTemplateBeanDefinition.java
      https://github.com/apache/camel/blob/main/core/camel-core-model/src/main/java/org/apache/camel/model/BeanFactoryDefinition.java#L59

      property:
        - key: foo
          value: :bar
      

      However "RegistryBeanDefinition" uses Map<String, Object> for properties, where the key is directly used for a property name (e.g. without explicit key/value entry).

      properties:
        foo:bar
        fooObj:
          fooObjProp: val
      

      While we would want to keep backward compatibility on Kamelets with string key/value, it would be nice also for Kamelet to support object properties just like non-template beans can do.
      So, I propose to use template bean "properties" to be Map<String, Object> to align with non-template beans, but not a list of "PropertyDefinition". Then we can keep template bean "property" as-is, a list of "PropertyDefinition", i.e. string key/value.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            igarashitm Tomohisa Igarashi
            igarashitm Tomohisa Igarashi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment