This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new c68834a11 chore: default data types on the Transformation, JSON and
EIP actions where the body is fixed (#3117) (#3263)
c68834a11 is described below
commit c68834a11922db6308e7d1d58ebe02dd237a85e2
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 19 15:31:36 2026 +0100
chore: default data types on the Transformation, JSON and EIP actions where
the body is fixed (#3117) (#3263)
* chore: Citrus tests for the Transformation, JSON and EIP actions that had
none (#3261)
Tests for the template actions (FreeMarker, Velocity, Mustache, MVEL,
StringTemplate), Jolt, JSLT, JSONata, the PDF, XJ template, JSON serialize
and JSON Schema actions, and the drop-header(s) and header-matches-filter
actions. Each test checks the body, and the Java type of the body and the
Content-Type that the Kamelet gives, so the data types of #3117 show what
they change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* chore: default data types on the Transformation, JSON and EIP actions
where the body is fixed (#3117)
json-serialize-action, hoist-field-action and jslt-action give JSON as bytes
(application-json); pdf-action and crypto-encrypt-action give bytes with
application/octet-stream; pdf-action takes text, and avro-deserialize-action
and protobuf-deserialize-action take bytes. jslt-action depends on
camel:jackson3 for the JSON transformer.
The Citrus tests of #3261 record the new body types. The crypto test sets
Content-Type back to text/plain after decrypting, as crypto-decrypt-action
keeps the application/octet-stream of the encrypted data.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* chore: crypto-decrypt-action - capitalise the sentence after the new one
(#3117)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
camel-kamelets-sbom/camel-kamelets-catalog-sbom.json | 2 +-
kamelets/avro-deserialize-action.kamelet.yaml | 8 ++++++++
kamelets/crypto-decrypt-action.kamelet.yaml | 2 +-
kamelets/crypto-encrypt-action.kamelet.yaml | 10 +++++++++-
kamelets/hoist-field-action.kamelet.yaml | 8 +++++++-
kamelets/jslt-action.kamelet.yaml | 11 ++++++++++-
kamelets/json-serialize-action.kamelet.yaml | 8 +++++++-
kamelets/pdf-action.kamelet.yaml | 17 ++++++++++++++++-
kamelets/protobuf-deserialize-action.kamelet.yaml | 8 ++++++++
.../src/main/resources/META-INF/kamelets-index.json | 12 ++++++------
.../kamelets/avro-deserialize-action.kamelet.yaml | 8 ++++++++
.../kamelets/crypto-decrypt-action.kamelet.yaml | 2 +-
.../kamelets/crypto-encrypt-action.kamelet.yaml | 10 +++++++++-
.../resources/kamelets/hoist-field-action.kamelet.yaml | 8 +++++++-
.../main/resources/kamelets/jslt-action.kamelet.yaml | 11 ++++++++++-
.../kamelets/json-serialize-action.kamelet.yaml | 8 +++++++-
.../src/main/resources/kamelets/pdf-action.kamelet.yaml | 17 ++++++++++++++++-
.../kamelets/protobuf-deserialize-action.kamelet.yaml | 8 ++++++++
.../src/test/resources/crypto/crypto-action-route.yaml | 6 ++++++
.../json/json-serialize-action-route.citrus.it.yaml | 2 +-
.../transformation/jslt-action-route.citrus.it.yaml | 4 ++--
.../transformation/pdf-action-route.citrus.it.yaml | 9 ++++-----
.../test/resources/transformation/pdf-action-route.yaml | 3 +++
23 files changed, 155 insertions(+), 27 deletions(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index 7443fa99e..9154c7d89 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -2664,7 +2664,7 @@
"dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:jslt-action",
- "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:json-deserialize-action",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
diff --git a/kamelets/avro-deserialize-action.kamelet.yaml
b/kamelets/avro-deserialize-action.kamelet.yaml
index 0ce793aca..eaf1dfc39 100644
--- a/kamelets/avro-deserialize-action.kamelet.yaml
+++ b/kamelets/avro-deserialize-action.kamelet.yaml
@@ -53,6 +53,14 @@ spec:
description: Meant to turn the check of the content against the schema
on or off. It has no effect.
type: boolean
default: true
+ dataTypes:
+ in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The Avro binary data, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:kamelet"
- "camel:jackson3-avro"
diff --git a/kamelets/crypto-decrypt-action.kamelet.yaml
b/kamelets/crypto-decrypt-action.kamelet.yaml
index f1d2b5686..ae74805d4 100644
--- a/kamelets/crypto-decrypt-action.kamelet.yaml
+++ b/kamelets/crypto-decrypt-action.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
Output: the body is the original data, as bytes (a stream). The headers
are kept.
- Good to know: data that was changed, or a different `algorithm`, `mode`
or `key` than when encrypting, fails the message with "Message authentication
failed". The key is a secret; keep it in a vault or a secret, not in plain
configuration.
+ Good to know: the `Content-Type` header is kept as it comes, which after
`crypto-encrypt-action` is `application/octet-stream`: set it again to the type
of the original data when the next step needs it, for example with
`insert-header-action`. Data that was changed, or a different `algorithm`,
`mode` or `key` than when encrypting, fails the message with "Message
authentication failed". The key is a secret; keep it in a vault or a secret,
not in plain configuration.
required:
- algorithm
- key
diff --git a/kamelets/crypto-encrypt-action.kamelet.yaml
b/kamelets/crypto-encrypt-action.kamelet.yaml
index b7543f502..757e9f17e 100644
--- a/kamelets/crypto-encrypt-action.kamelet.yaml
+++ b/kamelets/crypto-encrypt-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: text or bytes.
- Output: the body is the encrypted data, as bytes (a stream), a little
longer than the input. It is not text: to send it where only text fits, encode
it, for example in Base64. The headers are kept.
+ Output: the body is the encrypted data, as bytes, a little longer than
the input, and the `Content-Type` header is set to `application/octet-stream`.
It is not text: to send it where only text fits, encode it, for example in
Base64. The other headers are kept.
Good to know: the key is a secret; anyone who has it can decrypt the
data, so keep it in a vault or a secret, not in plain configuration. The
encrypted data carries a check value, so `crypto-decrypt-action` fails on data
that was changed or decrypted with another key. A key of the wrong length fails
each message, not the start. Set `mode` to `CBC`: without it, AES encrypts in
ECB mode, where equal parts of the data give equal encrypted bytes. Data
encrypted without `mode` is decryp [...]
required:
@@ -62,6 +62,14 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ dataTypes:
+ out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The encrypted data, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:kamelet"
- "camel:crypto"
diff --git a/kamelets/hoist-field-action.kamelet.yaml
b/kamelets/hoist-field-action.kamelet.yaml
index b32019d1d..811514fca 100644
--- a/kamelets/hoist-field-action.kamelet.yaml
+++ b/kamelets/hoist-field-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: any body. JSON is nested as a JSON object or array when it is
parsed JSON (a Map or a Jackson `JsonNode`), or JSON text with the
`Content-Type` header `application/json`. Any other text, including JSON text
with another `Content-Type`, becomes a text value: `hello` gives
`{"order":"hello"}`.
- Output: the body is the new JSON object, as JSON text, and the
`Content-Type` header is set to `application/json`.
+ Output: the body is the new JSON object, as JSON text in bytes, and the
`Content-Type` header is set to `application/json`.
required:
- field
properties:
@@ -55,11 +55,17 @@ spec:
description: When it is `application/json`, JSON text in the body is
nested as JSON. Otherwise text is nested as a text value.
type: string
out:
+ default: json
headers:
Content-Type:
title: Content Type
description: Always `application/json`.
type: string
+ types:
+ json:
+ format: "application-json"
+ description: "The new JSON object, as JSON text in bytes."
+ mediaType: application/json
dependencies:
- "camel:jackson3"
- "camel:kamelet"
diff --git a/kamelets/jslt-action.kamelet.yaml
b/kamelets/jslt-action.kamelet.yaml
index 397c810cc..49c90a4ac 100644
--- a/kamelets/jslt-action.kamelet.yaml
+++ b/kamelets/jslt-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: JSON text, bytes or a stream. The transformation sees the body as
`.` and a header as `$headers.name`, for example `{"customer": .name, "items":
size(.items), "source": $headers.origin}`.
- Output: the body is the result as JSON text. The headers are kept.
+ Output: the body is the result as JSON text in bytes, and the
`Content-Type` header is set to `application/json`. The other headers are kept.
Good to know: parsed JSON (a Map or a JsonNode, such as the output of
`json-deserialize-action`) fails the message: give the JSON as text. A field
whose value is missing, such as a header that is not set, is left out of the
result. The transformation is loaded from a file, the classpath or a URL given
by the `template` option; it cannot come from the message. Headers that start
with `CamelJslt` are removed from the message first, so they cannot change what
the Kamelet does.
required:
@@ -50,7 +50,16 @@ spec:
type: string
example: "file:///opt/templates/order.jslt"
pattern: "^(http|https|file|classpath|ref|bean)://.*"
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The result, as JSON text in bytes."
+ mediaType: application/json
dependencies:
+ - "camel:jackson3"
- "camel:jslt"
- "camel:kamelet"
template:
diff --git a/kamelets/json-serialize-action.kamelet.yaml
b/kamelets/json-serialize-action.kamelet.yaml
index 2d56f2280..8657c1e93 100644
--- a/kamelets/json-serialize-action.kamelet.yaml
+++ b/kamelets/json-serialize-action.kamelet.yaml
@@ -37,17 +37,23 @@ spec:
Input: parsed data: a Map, a List, or parsed JSON (a Jackson `JsonNode`).
- Output: the body is JSON text, as a stream of bytes. The `Content-Type`
header is set to `application/json`.
+ Output: the body is JSON text, as bytes. The `Content-Type` header is
set to `application/json`.
Good to know: a body that is already text becomes one JSON string, in
quotes: `hello` becomes `"hello"`, and JSON text is quoted the same way. Do not
use it on a body that is already JSON text.
type: object
dataTypes:
out:
+ default: json
headers:
Content-Type:
title: Content Type
description: "Always `application/json`."
type: string
+ types:
+ json:
+ format: "application-json"
+ description: "The JSON text, as bytes."
+ mediaType: application/json
dependencies:
- "camel:kamelet"
- "camel:jackson3"
diff --git a/kamelets/pdf-action.kamelet.yaml b/kamelets/pdf-action.kamelet.yaml
index 8e44ea984..5128220d5 100644
--- a/kamelets/pdf-action.kamelet.yaml
+++ b/kamelets/pdf-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: the body is the text to write, as text. Each line of the text
starts a new line in the PDF, and a new page starts when a page is full.
- Output: the body is the PDF document, as bytes. The headers are kept as
they are; a `Content-Type` header set before is not changed to PDF.
+ Output: the body is the PDF document, as bytes, and the `Content-Type`
header is set to `application/octet-stream`. The other headers are kept.
Good to know: long lines are not wrapped; they run past the right edge
of the page. Set `font` to one of the names its description lists, such as
`HELVETICA`, the default. Headers that start with `CamelPdf` are removed from
the message first, so they cannot change what the Kamelet does.
required:
@@ -63,6 +63,21 @@ spec:
type: string
default: A4
enum: ["LETTER", "LEGAL", "A0", "A1", "A2", "A3", "A4", "A5", "A6"]
+ dataTypes:
+ in:
+ default: text
+ types:
+ text:
+ format: "text-plain"
+ description: "The text to write."
+ mediaType: text/plain
+ out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The PDF document, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:pdf"
- "camel:kamelet"
diff --git a/kamelets/protobuf-deserialize-action.kamelet.yaml
b/kamelets/protobuf-deserialize-action.kamelet.yaml
index a996b9e37..68c2f2f68 100644
--- a/kamelets/protobuf-deserialize-action.kamelet.yaml
+++ b/kamelets/protobuf-deserialize-action.kamelet.yaml
@@ -47,6 +47,14 @@ spec:
description: "The Protobuf schema the data was written with, in the
`.proto` language: a `message` with its fields, each with a type, a name and a
number. When it is not set, the schema found by an earlier
`resolve-pojo-schema-action` is used."
type: string
example: 'message Person { required string first = 1; required string
last = 2; }'
+ dataTypes:
+ in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The Protobuf binary data, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:kamelet"
- "camel:jackson3-protobuf"
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 1662628da..4da1016ca 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -585,7 +585,7 @@
"supportLevel" : "Stable",
"title" : "Crypto Decrypt Action",
"summary" : "Decrypts the body of each message that
`crypto-encrypt-action` encrypted, with the same algorithm and secret key.",
- "description" : "Decrypts the body of each message that
`crypto-encrypt-action` encrypted, with the same algorithm and secret
key.\n\nUse it to get back the original data that was encrypted with
`crypto-encrypt-action`, for example after reading it from storage or receiving
it from another system.\n\nInput: the encrypted data exactly as
`crypto-encrypt-action` produced it, as bytes or a stream. If it was encoded on
the way, for example in Base64, decode it first.\n\nOutput: the body [...]
+ "description" : "Decrypts the body of each message that
`crypto-encrypt-action` encrypted, with the same algorithm and secret
key.\n\nUse it to get back the original data that was encrypted with
`crypto-encrypt-action`, for example after reading it from storage or receiving
it from another system.\n\nInput: the encrypted data exactly as
`crypto-encrypt-action` produced it, as bytes or a stream. If it was encoded on
the way, for example in Base64, decode it first.\n\nOutput: the body [...]
"group" : "Actions",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
@@ -595,7 +595,7 @@
"supportLevel" : "Stable",
"title" : "Crypto Encrypt Action",
"summary" : "Encrypts the body of each message with a secret key, such as
an AES key, for `crypto-decrypt-action` to decrypt later with the same key.",
- "description" : "Encrypts the body of each message with a secret key, such
as an AES key, for `crypto-decrypt-action` to decrypt later with the same
key.\n\nUse it to protect sensitive data, such as personal or payment details,
before it is stored or sent through a system you do not fully trust, and
decrypt it later with `crypto-decrypt-action` and the same `algorithm` and
`key`.\n\nInput: text or bytes.\n\nOutput: the body is the encrypted data, as
bytes (a stream), a little longer [...]
+ "description" : "Encrypts the body of each message with a secret key, such
as an AES key, for `crypto-decrypt-action` to decrypt later with the same
key.\n\nUse it to protect sensitive data, such as personal or payment details,
before it is stored or sent through a system you do not fully trust, and
decrypt it later with `crypto-decrypt-action` and the same `algorithm` and
`key`.\n\nInput: text or bytes.\n\nOutput: the body is the encrypted data, as
bytes, a little longer than the in [...]
"group" : "Actions",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
@@ -1015,7 +1015,7 @@
"supportLevel" : "Stable",
"title" : "Hoist Field Action",
"summary" : "Wraps the body of each message in a new JSON object, as the
value of the one field you name.",
- "description" : "Wraps the body of each message in a new JSON object, as
the value of the one field you name.\n\nUse it to nest the whole message under
one name, for example to turn `{\"id\":1}` into `{\"order\":{\"id\":1}}` for a
system that expects that shape. To do the opposite, and take the value out of a
field, use `extract-field-action`.\n\nInput: any body. JSON is nested as a JSON
object or array when it is parsed JSON (a Map or a Jackson `JsonNode`), or JSON
text with the `Co [...]
+ "description" : "Wraps the body of each message in a new JSON object, as
the value of the one field you name.\n\nUse it to nest the whole message under
one name, for example to turn `{\"id\":1}` into `{\"order\":{\"id\":1}}` for a
system that expects that shape. To do the opposite, and take the value out of a
field, use `extract-field-action`.\n\nInput: any body. JSON is nested as a JSON
object or array when it is parsed JSON (a Map or a Jackson `JsonNode`), or JSON
text with the `Co [...]
"group" : "Actions",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
@@ -1255,7 +1255,7 @@
"supportLevel" : "Stable",
"title" : "JSLT Action",
"summary" : "Turns each JSON message into new JSON with a JSLT
transformation, a query language for JSON that picks, renames and computes
fields.",
- "description" : "Turns each JSON message into new JSON with a JSLT
transformation, a query language for JSON that picks, renames and computes
fields.\n\nUse it to map the JSON of one system to the JSON another system
expects, for example to keep only some fields, rename them or count the items
of an order. To build text rather than JSON, use `mustache-template-action`;
`jolt-transformation-action` reshapes JSON with Jolt specifications
instead.\n\nInput: JSON text, bytes or a stream. [...]
+ "description" : "Turns each JSON message into new JSON with a JSLT
transformation, a query language for JSON that picks, renames and computes
fields.\n\nUse it to map the JSON of one system to the JSON another system
expects, for example to keep only some fields, rename them or count the items
of an order. To build text rather than JSON, use `mustache-template-action`;
`jolt-transformation-action` reshapes JSON with Jolt specifications
instead.\n\nInput: JSON text, bytes or a stream. [...]
"group" : "Actions",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
@@ -1285,7 +1285,7 @@
"supportLevel" : "Stable",
"title" : "Json Serialize Action",
"summary" : "Turns a body of parsed data, such as a Map, a List or parsed
JSON, into JSON text.",
- "description" : "Turns a body of parsed data, such as a Map, a List or
parsed JSON, into JSON text.\n\nUse it to send parsed data to a sink that needs
JSON text, for example after `jsonata-action` or `json-deserialize-action`,
whose output is parsed JSON. To do the opposite, use
`json-deserialize-action`.\n\nInput: parsed data: a Map, a List, or parsed JSON
(a Jackson `JsonNode`).\n\nOutput: the body is JSON text, as a stream of bytes.
The `Content-Type` header is set to `application [...]
+ "description" : "Turns a body of parsed data, such as a Map, a List or
parsed JSON, into JSON text.\n\nUse it to send parsed data to a sink that needs
JSON text, for example after `jsonata-action` or `json-deserialize-action`,
whose output is parsed JSON. To do the opposite, use
`json-deserialize-action`.\n\nInput: parsed data: a Map, a List, or parsed JSON
(a Jackson `JsonNode`).\n\nOutput: the body is JSON text, as bytes. The
`Content-Type` header is set to `application/json`.\n\nG [...]
"group" : "Actions",
"namespace" : "JSON",
"provider" : "Apache Software Foundation"
@@ -1645,7 +1645,7 @@
"supportLevel" : "Stable",
"title" : "PDF Action",
"summary" : "Turns the text of each message into a PDF document, with one
font, font size and page size for the whole text.",
- "description" : "Turns the text of each message into a PDF document, with
one font, font size and page size for the whole text.\n\nUse it to produce a
simple printable document, such as a receipt, a report or a log, that is then
stored as a file or sent by email. To lay out the text first, put a template
action before it, such as `mustache-template-action`.\n\nInput: the body is the
text to write, as text. Each line of the text starts a new line in the PDF, and
a new page starts when [...]
+ "description" : "Turns the text of each message into a PDF document, with
one font, font size and page size for the whole text.\n\nUse it to produce a
simple printable document, such as a receipt, a report or a log, that is then
stored as a file or sent by email. To lay out the text first, put a template
action before it, such as `mustache-template-action`.\n\nInput: the body is the
text to write, as text. Each line of the text starts a new line in the PDF, and
a new page starts when [...]
"group" : "PDF",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
index 0ce793aca..eaf1dfc39 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
@@ -53,6 +53,14 @@ spec:
description: Meant to turn the check of the content against the schema
on or off. It has no effect.
type: boolean
default: true
+ dataTypes:
+ in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The Avro binary data, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:kamelet"
- "camel:jackson3-avro"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/crypto-decrypt-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/crypto-decrypt-action.kamelet.yaml
index f1d2b5686..ae74805d4 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/crypto-decrypt-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/crypto-decrypt-action.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
Output: the body is the original data, as bytes (a stream). The headers
are kept.
- Good to know: data that was changed, or a different `algorithm`, `mode`
or `key` than when encrypting, fails the message with "Message authentication
failed". The key is a secret; keep it in a vault or a secret, not in plain
configuration.
+ Good to know: the `Content-Type` header is kept as it comes, which after
`crypto-encrypt-action` is `application/octet-stream`: set it again to the type
of the original data when the next step needs it, for example with
`insert-header-action`. Data that was changed, or a different `algorithm`,
`mode` or `key` than when encrypting, fails the message with "Message
authentication failed". The key is a secret; keep it in a vault or a secret,
not in plain configuration.
required:
- algorithm
- key
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/crypto-encrypt-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/crypto-encrypt-action.kamelet.yaml
index b7543f502..757e9f17e 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/crypto-encrypt-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/crypto-encrypt-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: text or bytes.
- Output: the body is the encrypted data, as bytes (a stream), a little
longer than the input. It is not text: to send it where only text fits, encode
it, for example in Base64. The headers are kept.
+ Output: the body is the encrypted data, as bytes, a little longer than
the input, and the `Content-Type` header is set to `application/octet-stream`.
It is not text: to send it where only text fits, encode it, for example in
Base64. The other headers are kept.
Good to know: the key is a secret; anyone who has it can decrypt the
data, so keep it in a vault or a secret, not in plain configuration. The
encrypted data carries a check value, so `crypto-decrypt-action` fails on data
that was changed or decrypted with another key. A key of the wrong length fails
each message, not the start. Set `mode` to `CBC`: without it, AES encrypts in
ECB mode, where equal parts of the data give equal encrypted bytes. Data
encrypted without `mode` is decryp [...]
required:
@@ -62,6 +62,14 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ dataTypes:
+ out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The encrypted data, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:kamelet"
- "camel:crypto"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/hoist-field-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/hoist-field-action.kamelet.yaml
index b32019d1d..811514fca 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/hoist-field-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/hoist-field-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: any body. JSON is nested as a JSON object or array when it is
parsed JSON (a Map or a Jackson `JsonNode`), or JSON text with the
`Content-Type` header `application/json`. Any other text, including JSON text
with another `Content-Type`, becomes a text value: `hello` gives
`{"order":"hello"}`.
- Output: the body is the new JSON object, as JSON text, and the
`Content-Type` header is set to `application/json`.
+ Output: the body is the new JSON object, as JSON text in bytes, and the
`Content-Type` header is set to `application/json`.
required:
- field
properties:
@@ -55,11 +55,17 @@ spec:
description: When it is `application/json`, JSON text in the body is
nested as JSON. Otherwise text is nested as a text value.
type: string
out:
+ default: json
headers:
Content-Type:
title: Content Type
description: Always `application/json`.
type: string
+ types:
+ json:
+ format: "application-json"
+ description: "The new JSON object, as JSON text in bytes."
+ mediaType: application/json
dependencies:
- "camel:jackson3"
- "camel:kamelet"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/jslt-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/jslt-action.kamelet.yaml
index 397c810cc..49c90a4ac 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/jslt-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/jslt-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: JSON text, bytes or a stream. The transformation sees the body as
`.` and a header as `$headers.name`, for example `{"customer": .name, "items":
size(.items), "source": $headers.origin}`.
- Output: the body is the result as JSON text. The headers are kept.
+ Output: the body is the result as JSON text in bytes, and the
`Content-Type` header is set to `application/json`. The other headers are kept.
Good to know: parsed JSON (a Map or a JsonNode, such as the output of
`json-deserialize-action`) fails the message: give the JSON as text. A field
whose value is missing, such as a header that is not set, is left out of the
result. The transformation is loaded from a file, the classpath or a URL given
by the `template` option; it cannot come from the message. Headers that start
with `CamelJslt` are removed from the message first, so they cannot change what
the Kamelet does.
required:
@@ -50,7 +50,16 @@ spec:
type: string
example: "file:///opt/templates/order.jslt"
pattern: "^(http|https|file|classpath|ref|bean)://.*"
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The result, as JSON text in bytes."
+ mediaType: application/json
dependencies:
+ - "camel:jackson3"
- "camel:jslt"
- "camel:kamelet"
template:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
index 2d56f2280..8657c1e93 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
@@ -37,17 +37,23 @@ spec:
Input: parsed data: a Map, a List, or parsed JSON (a Jackson `JsonNode`).
- Output: the body is JSON text, as a stream of bytes. The `Content-Type`
header is set to `application/json`.
+ Output: the body is JSON text, as bytes. The `Content-Type` header is
set to `application/json`.
Good to know: a body that is already text becomes one JSON string, in
quotes: `hello` becomes `"hello"`, and JSON text is quoted the same way. Do not
use it on a body that is already JSON text.
type: object
dataTypes:
out:
+ default: json
headers:
Content-Type:
title: Content Type
description: "Always `application/json`."
type: string
+ types:
+ json:
+ format: "application-json"
+ description: "The JSON text, as bytes."
+ mediaType: application/json
dependencies:
- "camel:kamelet"
- "camel:jackson3"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/pdf-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/pdf-action.kamelet.yaml
index 8e44ea984..5128220d5 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/pdf-action.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/pdf-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: the body is the text to write, as text. Each line of the text
starts a new line in the PDF, and a new page starts when a page is full.
- Output: the body is the PDF document, as bytes. The headers are kept as
they are; a `Content-Type` header set before is not changed to PDF.
+ Output: the body is the PDF document, as bytes, and the `Content-Type`
header is set to `application/octet-stream`. The other headers are kept.
Good to know: long lines are not wrapped; they run past the right edge
of the page. Set `font` to one of the names its description lists, such as
`HELVETICA`, the default. Headers that start with `CamelPdf` are removed from
the message first, so they cannot change what the Kamelet does.
required:
@@ -63,6 +63,21 @@ spec:
type: string
default: A4
enum: ["LETTER", "LEGAL", "A0", "A1", "A2", "A3", "A4", "A5", "A6"]
+ dataTypes:
+ in:
+ default: text
+ types:
+ text:
+ format: "text-plain"
+ description: "The text to write."
+ mediaType: text/plain
+ out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The PDF document, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:pdf"
- "camel:kamelet"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
index a996b9e37..68c2f2f68 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
@@ -47,6 +47,14 @@ spec:
description: "The Protobuf schema the data was written with, in the
`.proto` language: a `message` with its fields, each with a type, a name and a
number. When it is not set, the schema found by an earlier
`resolve-pojo-schema-action` is used."
type: string
example: 'message Person { required string first = 1; required string
last = 2; }'
+ dataTypes:
+ in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The Protobuf binary data, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:kamelet"
- "camel:jackson3-protobuf"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/crypto/crypto-action-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/crypto/crypto-action-route.yaml
index bef9bb253..0ee353447 100644
---
a/tests/camel-kamelets-itest/src/test/resources/crypto/crypto-action-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/crypto/crypto-action-route.yaml
@@ -34,5 +34,11 @@
parameters:
algorithm: '{{crypto.algorithm}}'
key: '{{crypto.key}}'
+ # the encrypted data is application/octet-stream, which decrypting
keeps: the text is text again
+ - to:
+ uri: "kamelet:insert-header-action"
+ parameters:
+ name: Content-Type
+ value: text/plain
- to:
uri: "{{http.sink.url}}/result"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
index 2b2586dda..a2d28d703 100644
---
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
@@ -35,7 +35,7 @@ actions:
path: "/result"
headers:
- name: "X-Body-Type"
- value: 'org.apache.camel.converter.stream.InputStreamCache'
+ value: '[B'
- name: "X-Content-Type"
value: 'ct=application/json'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/transformation/jslt-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/transformation/jslt-action-route.citrus.it.yaml
index 087f77989..ecd6d741d 100644
---
a/tests/camel-kamelets-itest/src/test/resources/transformation/jslt-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/transformation/jslt-action-route.citrus.it.yaml
@@ -37,9 +37,9 @@ actions:
path: "/result"
headers:
- name: "X-Body-Type"
- value: 'java.lang.String'
+ value: '[B'
- name: "X-Content-Type"
- value: 'ct='
+ value: 'ct=application/json'
body:
data: '{"customer":"Ann","source":"web"}'
- http:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.citrus.it.yaml
index 6391d588c..06aa51622 100644
---
a/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.citrus.it.yaml
@@ -33,14 +33,13 @@ actions:
receiveRequest:
POST:
path: "/result"
- type: "plaintext"
headers:
- name: "X-Body-Type"
- value: 'java.io.ByteArrayOutputStream'
+ value: '[B'
+ - name: "X-Pdf-Signature"
+ value: '%PDF-'
- name: "X-Content-Type"
- value: 'ct='
- body:
- data: '@startsWith(''%PDF-'')@'
+ value: 'ct=application/octet-stream'
- http:
server: "httpServer"
sendResponse:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.yaml
index 6924f6466..f502f4c0a 100644
---
a/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/transformation/pdf-action-route.yaml
@@ -31,6 +31,9 @@ Line two'
- setHeader:
name: X-Body-Type
simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Pdf-Signature
+ simple: "${bodyAs(String).substring(0,5)}"
- setHeader:
name: X-Content-Type
simple: "ct=${header.Content-Type}"