chore: add checks for duplicate titles and descriptions and fix format
diff --git a/aws-sns-fifo-sink.kamelet.yaml b/aws-sns-fifo-sink.kamelet.yaml
index b12d959..abb2153 100644
--- a/aws-sns-fifo-sink.kamelet.yaml
+++ b/aws-sns-fifo-sink.kamelet.yaml
@@ -11,7 +11,7 @@
spec:
definition:
title: AWS SNS FIFO Sink
- description: Send message to an AWS SQS FIFO Queue
+ description: Send message to an AWS SNS FIFO Topic
required:
- topicNameOrArn
- accessKey
diff --git a/docs/modules/ROOT/assets/images/kamelets/extract-field-action.svg b/docs/modules/ROOT/assets/images/kamelets/extract-field-action.svg
new file mode 100644
index 0000000..fa06352
--- /dev/null
+++ b/docs/modules/ROOT/assets/images/kamelets/extract-field-action.svg
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ viewBox="0 -256 1792 1792"
+ id="svg3025"
+ version="1.1"
+ inkscape:version="0.48.3.1 r9886"
+ width="100%"
+ height="100%"
+ sodipodi:docname="cog_font_awesome.svg">
+ <metadata
+ id="metadata3035">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs3033" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="640"
+ inkscape:window-height="480"
+ id="namedview3031"
+ showgrid="false"
+ inkscape:zoom="0.13169643"
+ inkscape:cx="896"
+ inkscape:cy="896"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg3025" />
+ <g
+ transform="matrix(1,0,0,-1,121.49153,1285.4237)"
+ id="g3027">
+ <path
+ d="m 1024,640 q 0,106 -75,181 -75,75 -181,75 -106,0 -181,-75 -75,-75 -75,-181 0,-106 75,-181 75,-75 181,-75 106,0 181,75 75,75 75,181 z m 512,109 V 527 q 0,-12 -8,-23 -8,-11 -20,-13 l -185,-28 q -19,-54 -39,-91 35,-50 107,-138 10,-12 10,-25 0,-13 -9,-23 -27,-37 -99,-108 -72,-71 -94,-71 -12,0 -26,9 l -138,108 q -44,-23 -91,-38 -16,-136 -29,-186 -7,-28 -36,-28 H 657 q -14,0 -24.5,8.5 Q 622,-111 621,-98 L 593,86 q -49,16 -90,37 L 362,16 Q 352,7 337,7 323,7 312,18 186,132 147,186 q -7,10 -7,23 0,12 8,23 15,21 51,66.5 36,45.5 54,70.5 -27,50 -41,99 L 29,495 Q 16,497 8,507.5 0,518 0,531 v 222 q 0,12 8,23 8,11 19,13 l 186,28 q 14,46 39,92 -40,57 -107,138 -10,12 -10,24 0,10 9,23 26,36 98.5,107.5 72.5,71.5 94.5,71.5 13,0 26,-10 l 138,-107 q 44,23 91,38 16,136 29,186 7,28 36,28 h 222 q 14,0 24.5,-8.5 Q 914,1391 915,1378 l 28,-184 q 49,-16 90,-37 l 142,107 q 9,9 24,9 13,0 25,-10 129,-119 165,-170 7,-8 7,-22 0,-12 -8,-23 -15,-21 -51,-66.5 -36,-45.5 -54,-70.5 26,-50 41,-98 l 183,-28 q 13,-2 21,-12.5 8,-10.5 8,-23.5 z"
+ id="path3029"
+ inkscape:connector-curvature="0"
+ style="fill:currentColor" />
+ </g>
+</svg>
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index a2a1ee4..16279b2 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -31,6 +31,7 @@
* xref:ROOT:elasticsearch-index-sink.adoc[image:kamelets/elasticsearch-index-sink.svg[] ElasticSearch Index Sink]
* xref:ROOT:elasticsearch-search-source.adoc[image:kamelets/elasticsearch-search-source.svg[] ElasticSearch Index Source]
* xref:ROOT:exec-sink.adoc[image:kamelets/exec-sink.svg[] Exec Sink]
+* xref:ROOT:extract-field-action.adoc[image:kamelets/extract-field-action.svg[] Extract Field Action]
* xref:ROOT:fhir-source.adoc[image:kamelets/fhir-source.svg[] Fhir Source]
* xref:ROOT:file-watch-source.adoc[image:kamelets/file-watch-source.svg[] File Watch Source]
* xref:ROOT:ftp-source.adoc[image:kamelets/ftp-source.svg[] FTP Source]
@@ -42,8 +43,8 @@
* xref:ROOT:http-sink.adoc[image:kamelets/http-sink.svg[] HTTP Sink]
* xref:ROOT:http-source.adoc[image:kamelets/http-source.svg[] HTTP Source]
* xref:ROOT:infinispan-source.adoc[image:kamelets/infinispan-source.svg[] Infinispan Source]
-* xref:ROOT:insert-field-action.adoc[image:kamelets/insert-field-action.svg[] Insert Field]
-* xref:ROOT:insert-header-action.adoc[image:kamelets/insert-header-action.svg[] Insert Header]
+* xref:ROOT:insert-field-action.adoc[image:kamelets/insert-field-action.svg[] Insert Field Action]
+* xref:ROOT:insert-header-action.adoc[image:kamelets/insert-header-action.svg[] Insert Header Action]
* xref:ROOT:jira-source.adoc[image:kamelets/jira-source.svg[] Jira Source]
* xref:ROOT:kafka-not-secured-sink.adoc[image:kamelets/kafka-not-secured-sink.svg[] Kafka Not Secured Sink]
* xref:ROOT:kafka-not-secured-source.adoc[image:kamelets/kafka-not-secured-source.svg[] Kafka Not Secured Source]
@@ -57,7 +58,7 @@
* xref:ROOT:openai-completion-action.adoc[image:kamelets/openai-completion-action.svg[] OpenAI Completion Action]
* xref:ROOT:pdf-action.adoc[image:kamelets/pdf-action.svg[] PDF Action]
* xref:ROOT:rabbitmq-source.adoc[image:kamelets/rabbitmq-source.svg[] RabbitMQ Source]
-* xref:ROOT:replace-field-action.adoc[image:kamelets/replace-field-action.svg[] Replace Field]
+* xref:ROOT:replace-field-action.adoc[image:kamelets/replace-field-action.svg[] Replace Field Action]
* xref:ROOT:salesforce-source.adoc[image:kamelets/salesforce-source.svg[] Salesforce Source]
* xref:ROOT:sftp-source.adoc[image:kamelets/sftp-source.svg[] SFTP Source]
* xref:ROOT:slack-source.adoc[image:kamelets/slack-source.svg[] Slack Source]
@@ -68,6 +69,6 @@
* xref:ROOT:twitter-directmessage-source.adoc[image:kamelets/twitter-directmessage-source.svg[] Twitter Direct Message Source]
* xref:ROOT:twitter-search-source.adoc[image:kamelets/twitter-search-source.svg[] Twitter Search Source]
* xref:ROOT:twitter-timeline-source.adoc[image:kamelets/twitter-timeline-source.svg[] Twitter Timeline Source]
-* xref:ROOT:value-to-key-action.adoc[image:kamelets/value-to-key-action.svg[] Value to Key action]
+* xref:ROOT:value-to-key-action.adoc[image:kamelets/value-to-key-action.svg[] Value to Key Action]
* xref:ROOT:webhook-source.adoc[image:kamelets/webhook-source.svg[] Webhook Source]
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
diff --git a/docs/modules/ROOT/pages/aws-sns-fifo-sink.adoc b/docs/modules/ROOT/pages/aws-sns-fifo-sink.adoc
index d8a9058..c5fb178 100644
--- a/docs/modules/ROOT/pages/aws-sns-fifo-sink.adoc
+++ b/docs/modules/ROOT/pages/aws-sns-fifo-sink.adoc
@@ -3,7 +3,7 @@
*Provided by: "Apache Software Foundation"*
-Send message to an AWS SQS FIFO Queue
+Send message to an AWS SNS FIFO Topic
== Configuration Options
diff --git a/docs/modules/ROOT/pages/insert-field.adoc b/docs/modules/ROOT/pages/extract-field-action.adoc
similarity index 66%
rename from docs/modules/ROOT/pages/insert-field.adoc
rename to docs/modules/ROOT/pages/extract-field-action.adoc
index 8865775..7031423 100644
--- a/docs/modules/ROOT/pages/insert-field.adoc
+++ b/docs/modules/ROOT/pages/extract-field-action.adoc
@@ -1,37 +1,36 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
-= image:kamelets/insert-field.svg[] Insert Field
+= image:kamelets/extract-field-action.svg[] Extract Field Action
*Provided by: "Apache Software Foundation"*
-Adds a custom field with a constant value to the message in transit
+Extract a field from the body
== Configuration Options
-The following table summarizes the configuration options available for the `insert-field` Kamelet:
+The following table summarizes the configuration options available for the `extract-field-action` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *field {empty}* *| Field| The name of the field to be added| string| |
-| *value {empty}* *| Value| The value of the field| string| |
|===
NOTE: Fields marked with ({empty}*) are mandatory.
== Usage
-This section summarizes how the `insert-field` can be used in various contexts.
+This section summarizes how the `extract-field-action` can be used in various contexts.
=== Knative Action
-The `insert-field` Kamelet can be used as intermediate step in a binding.
+The `extract-field-action` Kamelet can be used as intermediate step in a binding.
-.insert-field-binding.yaml
+.extract-field-action-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
- name: insert-field-binding
+ name: extract-field-action-binding
spec:
source:
ref:
@@ -44,10 +43,9 @@
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
- name: insert-field
+ name: extract-field-action
properties:
field: "The Field"
- value: "The Value"
sink:
ref:
kind: InMemoryChannel
@@ -58,12 +56,12 @@
Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.
-Save the `insert-field-binding.yaml` file into your hard drive, then configure it according to your needs.
+Save the `extract-field-action-binding.yaml` file into your hard drive, then configure it according to your needs.
You can run the action using the following command:
[source,shell]
----
-kubectl apply -f insert-field-binding.yaml
+kubectl apply -f extract-field-action-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
diff --git a/docs/modules/ROOT/pages/insert-field-action.adoc b/docs/modules/ROOT/pages/insert-field-action.adoc
index 14502bd..ce77046 100644
--- a/docs/modules/ROOT/pages/insert-field-action.adoc
+++ b/docs/modules/ROOT/pages/insert-field-action.adoc
@@ -1,5 +1,5 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
-= image:kamelets/insert-field-action.svg[] Insert Field
+= image:kamelets/insert-field-action.svg[] Insert Field Action
*Provided by: "Apache Software Foundation"*
diff --git a/docs/modules/ROOT/pages/insert-header-action.adoc b/docs/modules/ROOT/pages/insert-header-action.adoc
index b3fba9e..6a53f6c 100644
--- a/docs/modules/ROOT/pages/insert-header-action.adoc
+++ b/docs/modules/ROOT/pages/insert-header-action.adoc
@@ -1,5 +1,5 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
-= image:kamelets/insert-header-action.svg[] Insert Header
+= image:kamelets/insert-header-action.svg[] Insert Header Action
*Provided by: "Apache Software Foundation"*
diff --git a/docs/modules/ROOT/pages/kafka-not-secured-sink.adoc b/docs/modules/ROOT/pages/kafka-not-secured-sink.adoc
index 0c07d35..3d9ec0b 100644
--- a/docs/modules/ROOT/pages/kafka-not-secured-sink.adoc
+++ b/docs/modules/ROOT/pages/kafka-not-secured-sink.adoc
@@ -3,7 +3,7 @@
*Provided by: "Apache Software Foundation"*
-Send data to Kafka topics.
+Send data to Kafka topics on an insecure broker.
The Kamelet is able to understand the following headers to be set:
diff --git a/docs/modules/ROOT/pages/kafka-not-secured-source.adoc b/docs/modules/ROOT/pages/kafka-not-secured-source.adoc
index 2655966..6620a9b 100644
--- a/docs/modules/ROOT/pages/kafka-not-secured-source.adoc
+++ b/docs/modules/ROOT/pages/kafka-not-secured-source.adoc
@@ -3,7 +3,7 @@
*Provided by: "Apache Software Foundation"*
-Receive data from Kafka topics.
+Receive data from Kafka topics on an insecure broker.
== Configuration Options
diff --git a/docs/modules/ROOT/pages/replace-field-action.adoc b/docs/modules/ROOT/pages/replace-field-action.adoc
index 5636961..a3aaaa1 100644
--- a/docs/modules/ROOT/pages/replace-field-action.adoc
+++ b/docs/modules/ROOT/pages/replace-field-action.adoc
@@ -1,9 +1,9 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
-= image:kamelets/replace-field-action.svg[] Replace Field
+= image:kamelets/replace-field-action.svg[] Replace Field Action
*Provided by: "Apache Software Foundation"*
-Adds a custom field with a constant value to the message in transit
+Replaces a field with a constant value in the message in transit
== Configuration Options
diff --git a/docs/modules/ROOT/pages/value-to-key-action.adoc b/docs/modules/ROOT/pages/value-to-key-action.adoc
index 1265bb6..a688b04 100644
--- a/docs/modules/ROOT/pages/value-to-key-action.adoc
+++ b/docs/modules/ROOT/pages/value-to-key-action.adoc
@@ -1,5 +1,5 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
-= image:kamelets/value-to-key-action.svg[] Value to Key action
+= image:kamelets/value-to-key-action.svg[] Value to Key Action
*Provided by: "Apache Software Foundation"*
diff --git a/extract-field-action.kamelet.yaml b/extract-field-action.kamelet.yaml
index c313e34..b078da1 100644
--- a/extract-field-action.kamelet.yaml
+++ b/extract-field-action.kamelet.yaml
@@ -10,7 +10,7 @@
camel.apache.org/kamelet.group: "Actions"
spec:
definition:
- title: "Extract Field"
+ title: "Extract Field Action"
description: "Extract a field from the body"
required:
- field
diff --git a/insert-field-action.kamelet.yaml b/insert-field-action.kamelet.yaml
index 2e18255..c1dcf4a 100644
--- a/insert-field-action.kamelet.yaml
+++ b/insert-field-action.kamelet.yaml
@@ -10,7 +10,7 @@
camel.apache.org/kamelet.group: "Actions"
spec:
definition:
- title: "Insert Field"
+ title: "Insert Field Action"
description: "Adds a custom field with a constant value to the message in transit"
required:
- field
diff --git a/insert-header-action.kamelet.yaml b/insert-header-action.kamelet.yaml
index fdd49f1..edf461d 100644
--- a/insert-header-action.kamelet.yaml
+++ b/insert-header-action.kamelet.yaml
@@ -10,7 +10,7 @@
camel.apache.org/kamelet.group: "Actions"
spec:
definition:
- title: "Insert Header"
+ title: "Insert Header Action"
description: "Adds an header with a constant value to the message in transit"
required:
- name
diff --git a/kafka-not-secured-sink.kamelet.yaml b/kafka-not-secured-sink.kamelet.yaml
index a475d15..53b65fd 100644
--- a/kafka-not-secured-sink.kamelet.yaml
+++ b/kafka-not-secured-sink.kamelet.yaml
@@ -12,7 +12,7 @@
definition:
title: "Kafka Not Secured Sink"
description: |-
- Send data to Kafka topics.
+ Send data to Kafka topics on an insecure broker.
The Kamelet is able to understand the following headers to be set:
diff --git a/kafka-not-secured-source.kamelet.yaml b/kafka-not-secured-source.kamelet.yaml
index 072f299..9b48ab1 100644
--- a/kafka-not-secured-source.kamelet.yaml
+++ b/kafka-not-secured-source.kamelet.yaml
@@ -12,7 +12,7 @@
definition:
title: "Kafka Not Secured Source"
description: |-
- Receive data from Kafka topics.
+ Receive data from Kafka topics on an insecure broker.
required:
- topic
- brokers
diff --git a/replace-field-action.kamelet.yaml b/replace-field-action.kamelet.yaml
index d32fecf..77fd0c7 100644
--- a/replace-field-action.kamelet.yaml
+++ b/replace-field-action.kamelet.yaml
@@ -10,8 +10,8 @@
camel.apache.org/kamelet.group: "Actions"
spec:
definition:
- title: "Replace Field"
- description: "Adds a custom field with a constant value to the message in transit"
+ title: "Replace Field Action"
+ description: "Replaces a field with a constant value in the message in transit"
required:
- enabled
- disabled
diff --git a/script/validator/validator.go b/script/validator/validator.go
index 21637c6..a6cfb29 100644
--- a/script/validator/validator.go
+++ b/script/validator/validator.go
@@ -38,6 +38,7 @@
errors = append(errors, verifyParameters(kamelets)...)
errors = append(errors, verifyInvalidContent(kamelets)...)
errors = append(errors, verifyDescriptors(kamelets)...)
+ errors = append(errors, verifyDuplicates(kamelets)...)
for _, err := range errors {
fmt.Printf("ERROR: %v\n", err)
@@ -47,6 +48,28 @@
}
}
+func verifyDuplicates(kamelets []KameletInfo) (errors []error) {
+ usedTitles := make(map[string]bool)
+ usedDescriptions := make(map[string]bool)
+ for _, kamelet := range kamelets {
+ if kamelet.Spec.Definition == nil {
+ errors = append(errors, fmt.Errorf("kamelet %q does not contain the JSON schema definition", kamelet.Name))
+ continue
+ }
+ title := kamelet.Kamelet.Spec.Definition.Title
+ if _, found := usedTitles[title]; found {
+ errors = append(errors, fmt.Errorf("kamelet %q has duplicate title %q", kamelet.Name, title))
+ }
+ description := kamelet.Kamelet.Spec.Definition.Description
+ if _, found := usedDescriptions[description]; found {
+ errors = append(errors, fmt.Errorf("kamelet %q has duplicate description %q", kamelet.Name, description))
+ }
+ usedTitles[title] = true
+ usedDescriptions[description] = true
+ }
+ return errors
+}
+
func verifyDescriptors(kamelets []KameletInfo) (errors []error) {
for _, kamelet := range kamelets {
if kamelet.Spec.Definition == nil {
@@ -134,6 +157,14 @@
}
if kamelet.Spec.Definition.Title == "" {
errors = append(errors, fmt.Errorf("kamelet %q does not contain title", kamelet.Name))
+ } else {
+ tp := kamelet.Labels["camel.apache.org/kamelet.type"]
+ if len(tp) > 1 {
+ expectedSuffix := strings.ToUpper(tp[0:1]) + tp[1:]
+ if !strings.HasSuffix(kamelet.Spec.Definition.Title, expectedSuffix) {
+ errors = append(errors, fmt.Errorf("kamelet %q title %q does not ends with %q", kamelet.Name, kamelet.Spec.Definition.Title, expectedSuffix))
+ }
+ }
}
if kamelet.Spec.Definition.Description == "" {
errors = append(errors, fmt.Errorf("kamelet %q does not contain description", kamelet.Name))
diff --git a/value-to-key-action.kamelet.yaml b/value-to-key-action.kamelet.yaml
index b24a31c..a246211 100644
--- a/value-to-key-action.kamelet.yaml
+++ b/value-to-key-action.kamelet.yaml
@@ -10,7 +10,7 @@
camel.apache.org/kamelet.group: "Actions"
spec:
definition:
- title: "Value to Key action"
+ title: "Value to Key Action"
description: "Replace the Kafka record key with a new key formed from a subset of fields in the body"
required:
- fields