You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2020/09/17 09:10:13 UTC

[camel-k] 18/21: chore(doc): add x-descriptors and fix

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit eb5258d5cff288e26c2391fd7f53876ef6695361
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Thu Sep 10 16:23:37 2020 +0200

    chore(doc): add x-descriptors and fix
---
 examples/kamelets/kamelet-binding-example.yaml |  4 ++-
 examples/kamelets/timer-source.kamelet.yaml    | 37 ++++++++++++++++++++++++++
 examples/kamelets/timer.kamelet.yaml           | 37 --------------------------
 pkg/apis/camel/v1alpha1/jsonschema_types.go    |  4 +++
 4 files changed, 44 insertions(+), 38 deletions(-)

diff --git a/examples/kamelets/kamelet-binding-example.yaml b/examples/kamelets/kamelet-binding-example.yaml
index 7e3d95d..d2fe9e6 100644
--- a/examples/kamelets/kamelet-binding-example.yaml
+++ b/examples/kamelets/kamelet-binding-example.yaml
@@ -7,7 +7,9 @@ spec:
     ref:
       kind: Kamelet
       apiVersion: camel.apache.org/v1alpha1
-      name: timer
+      name: timer-source
+    properties:
+      message: "Hello world!"
   sink:
     ref:
       kind: InMemoryChannel
diff --git a/examples/kamelets/timer-source.kamelet.yaml b/examples/kamelets/timer-source.kamelet.yaml
new file mode 100644
index 0000000..983a948
--- /dev/null
+++ b/examples/kamelets/timer-source.kamelet.yaml
@@ -0,0 +1,37 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: timer-source
+  annotations:
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm [...]
+  labels:
+    camel.apache.org/kamelet.type: "source"
+spec:
+  definition:
+    title: "Timer Source"
+    description: "Produces periodic events with a custom payload"
+    required:
+      - message
+    properties:
+      period:
+        title: Period
+        description: The interval between two events
+        type: integer
+        default: 1000
+      message:
+        title: Message
+        description: The message to generate
+        type: string
+        example: "hello world"
+  types:
+    out:
+      mediaType: text/plain
+  flow:
+    from:
+      uri: timer:tick
+      parameters:
+        period: "#property:period"
+      steps:
+      - set-body:
+          constant: "#property:message"
+      - to: "direct:#property:routeId"
diff --git a/examples/kamelets/timer.kamelet.yaml b/examples/kamelets/timer.kamelet.yaml
deleted file mode 100644
index 554e15b..0000000
--- a/examples/kamelets/timer.kamelet.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-apiVersion: camel.apache.org/v1alpha1
-kind: Kamelet
-metadata:
-  name: timer
-  annotations:
-    camel.apache.org/kamelet.icon: timer
-spec:
-  definition:
-    title: "Timer"
-    description: "Produces periodic events with a custom payload"
-    required:
-      - message
-    properties:
-      period:
-        title: Period
-        description: The time interval between two events
-        type: integer
-        default: 1000
-      message:
-        title: Message
-        description: The message to generate
-        type: string
-  types:
-    out:
-      mediaType: application/json
-      schema:
-        id: text.camel.apache.org
-        type: string
-  flow:
-    from:
-      uri: timer:tick
-      parameters:
-        period: "{{period}}"
-      steps:
-        - set-body:
-            constant: "{{message}}"
-        - to: "direct:{{routeId}}"
diff --git a/pkg/apis/camel/v1alpha1/jsonschema_types.go b/pkg/apis/camel/v1alpha1/jsonschema_types.go
index a66b131..6c3322c 100644
--- a/pkg/apis/camel/v1alpha1/jsonschema_types.go
+++ b/pkg/apis/camel/v1alpha1/jsonschema_types.go
@@ -166,6 +166,10 @@ type JSONSchemaProps struct {
 	//      Atomic maps will be entirely replaced when updated.
 	// +optional
 	XMapType *string `json:"x-kubernetes-map-type,omitempty" protobuf:"bytes,43,opt,name=xKubernetesMapType"`
+
+	// x-descriptors annotates an object to define additional display options.
+	// +optional
+	XDescriptors []string `json:"x-descriptors,omitempty" protobuf:"bytes,44,opt,name=xDescriptors"`
 }
 
 // JSON represents any valid JSON value.