KaotoIO / kaoto-ui

Frontend for the Kaoto project to provide an easy-to-use integration framework based on Apache Camel.
https://www.kaoto.io
Apache License 2.0
88 stars 44 forks source link

[Epic] Support expression dialect #1506

Open igarashitm opened 1 year ago

igarashitm commented 1 year ago

Describe the Bug

We support

- from:
    uri: timer:null
    steps:
    - set-body:
        simple: test

but not

- from:
    uri: timer:null
    steps:
    - set-body:
        expression:
          simple:
            expression: test

Both needs to be supported as a dialect. Canvas should show same diagram on both route above. There're several EIPs uses expression, some of them has its step extension, but the others don't. Both of default Config tab and step extensions should make a fix for this.

Related Issues

Steps to Reproduce the Bug or Issue

  1. Open source code editor
  2. Paste the 2nd YAML above

Screenshots or Videos

No response

Platform

igarashitm commented 1 year ago

We might be able to keep expression object as-is in default config tab, with "disabled"-ish style and suggest user to configure in source code editor. but definitely not lose the data.

Split step is a good example which doesn't have a step extension, but already has expression as a property. It looks like this now. If we are OK with this for 1.0, we can just do the same for existing step extensions. But eventually we will need to show the condition and let user configure in the same way across dialects. Screenshot from 2023-03-17 14-37-05

igarashitm commented 1 year ago

The other option for post 1.0 is to align to the one of dialects we choose, and always convert into the chosen one. IMO it's not necessary to preserve the source code in a dialect user choose, as long as it's semantically preserved. It's just a kind of auto code formatting. If user wants to keep the source code at that level, they should use some other code editor alone. Or we can add hardcore source editing mode which disables the canvas completely.

Delawen commented 1 year ago

I am all for converting identical code into a single coding style. Consistency pushing the user into what are best practices.

igarashitm commented 1 year ago

This seems to be an another dialect to support

- from:
    uri: timer:null
    steps:
    - set-body:
        simple:
          expression: test
          resultType: String

And enforcing resultType seems NOT to be supported with the simplest dialect (1st in the description). So if we go to the auto-converting route, we should choose one of the verbose styles. https://stackoverflow.com/questions/75003733/apache-camel-yaml-dsl-expression-returning-custom-datatype

igarashitm commented 1 year ago

We need to test if it doesn't break expression object when the condition is modified through default Config tab and step extensions (https://github.com/KaotoIO/step-extension-repository/issues/405), but blocked by https://github.com/KaotoIO/kaoto-backend/issues/554

igarashitm commented 1 year ago

Since the individual issues toward 1.0 are identified, I'm removing this from stabilization sprint, but keep this Epic open for the post 1.0 permanent fix for complete dialect support.