KaotoIO / kaoto-backend

Backend for the Kaoto project to provide an easy to use integration framework based on Apache Camel.
Apache License 2.0
75 stars 32 forks source link

[BUG] Syncing a Kamelet or KameletBinding with a description returns an empty flow #737

Closed lordrip closed 1 year ago

lordrip commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Open the source code editor
  2. Fill in the following YAML
Yaml ```yaml apiVersion: camel.apache.org/v1alpha1 kind: KameletBinding metadata: name: route-4127 spec: description: |- Receive all text messages that people send to your telegram bot. source: properties: {} ref: apiVersion: camel.apache.org/v1alpha1 kind: Kamelet name: aws-cloudtrail-source types: {} sink: properties: {} ref: apiVersion: camel.apache.org/v1alpha1 kind: Kamelet name: aws-cloudwatch-sink types: {} ```
  1. Press sync
  2. See the console error as the flow is empty

Expected behavior The backend should return a flow without steps but the rest of the information, e.g.:

JSON ```json { "flows": [ { "steps": [], "metadata": { "labels": { "camel.apache.org/kamelet.type": "action" }, "annotations": {}, "additionalProperties": {}, "name": "route-2782-action", "definition": { "properties": {}, "title": "" }, "beans": null, "dependencies": [ "camel:core" ], "spec": { "definition": { "properties": {}, "title": "" }, "dependencies": [ "camel:core" ], "template": {} } }, "parameters": [], "dsl": "Kamelet" } ] } ```
igarashitm commented 1 year ago

@lordrip there's no description under Kamelet spec, did you mean /spec/definition/description for Kamelet? https://camel.apache.org/camel-k/1.12.x/apis/kamelets.html#_camel_apache_org_v1alpha1_JSONSchemaProps It's successfully preserved.

For KameletBinding, I can't find description explicitly declared, it could be in metadata, but not yet sure. https://camel.apache.org/camel-k/1.12.x/apis/kamelets.html#_camel_apache_org_v1alpha1_KameletBinding

EDIT: KameletBinding doesn't have description ATM. https://github.com/apache/camel-k/issues/4535

igarashitm commented 1 year ago

The issue would be rather returning an empty integration JSON instead of just removing invalid property - or did we decide to return an error instead so that frontend can stop reflecting and show the error to the user?

igarashitm commented 1 year ago

Releasing as now I'm not sure how it's supposed to be

igarashitm commented 1 year ago

Re-evaluate this once https://github.com/KaotoIO/kaoto-backend/issues/751 and https://github.com/KaotoIO/kaoto-ui/issues/1795 are addressed

Delawen commented 1 year ago

I would say close this as the yaml is invalid.

The description in Bindings is stored as an annotation.