davsclaus opened a new pull request, #28302:
URL: https://github.com/apache/camel/pull/28302
Stacked on #28298. This group of the catalog body types (CAMEL-24961) takes
the last 20 data formats, the binary ones. With it, all 56 data formats of the
catalog have body types.
**What the catalog says now**
| Data format | Unmarshal gives | Marshal takes |
|---|---|---|
| avro | an object of the instanceClassName class | an Avro record: a
generated class, or a GenericRecord of the schema of instanceClassName |
| avroJackson | a Map, or a List for an array schema | a Map, a List or a
POJO, with the schema of the schemaResolver |
| protobuf | the generated Message of instanceClass, from binary, or from
JSON with contentTypeFormat=json | a Message, or a Map of its fields |
| protobufJackson | a Map of the fields | a Map or a POJO |
| thrift | the generated TBase of instanceClass; sjson is for marshal only |
a TBase |
| cbor | an object of unmarshalType: unmarshal fails without it today | a
Map, a List or a POJO |
| fory | `unknown`: the class in the data | a Map, a List or a POJO |
| parquetAvro | a List of the records, or an iterator with lazyLoad | a List
of GenericRecords or of POJOs |
| zipFile, tarFile | the content of the one entry as a stream, or an
iterator with usingIterator | text, bytes, a stream or a file |
| gzipDeflater, zipDeflater, lzf | the decompressed data as a stream | text,
bytes, a stream or a file |
| crypto, pgp | the decrypted data as a stream | text, bytes, a stream or a
file |
| pqc | the decrypted data as a byte array | text, bytes, a stream or a file
|
| xmlSecurity | the decrypted XML as a byte array | XML as text, bytes, a
stream, a file or a DOM |
| barcode | the text of the barcode | the text to encode |
| mimeMultipart | the first part as a stream, with the other parts as
attachments | the body, with the attachments as the other parts |
| smooks | `unknown`: what the exports of the config give | a Java object
graph |
After marshal, the body is the stream cache (a byte array when stream
caching is off), as for every data format.
**Also:**
- **jackson and jacksonXml:** the body after unmarshal now depends on
allowJmsType as well, since the JMSType header picks the class when it is set.
- **The validator:** it reads the body after unmarshal, and avro with its
default library, Jackson, now gives parsed data.
**Checked at runtime.** About 120 cases run with `camel run` logged the
class of the body after each step. They include file bodies for every data
format that reads a stream, looking for the base64 problem of CAMEL-25995:
- **Read eagerly, so files work:** the archive, compression and encryption
formats.
- **Fails with files:** mimeMultipart (below).
**Bugs found:**
- CAMEL-26004 (Major): tarFile with usingIterator gives empty entries in a
split that is not streaming.
- CAMEL-26005 (Major): protobufJackson writes JSON text as it is, labelled
application/protobuf (since 4.23.0).
- CAMEL-26006: cbor unmarshal fails without unmarshalType, which is the
first example of its docs.
- CAMEL-26007: mimeMultipart gives a closed stream for a file that is not a
multipart.
- CAMEL-26008: a zip or tar with a folder entry fails as more than one entry.
- CAMEL-26009: tarFile marshal fails after the body changed, as it trusts
CamelFileLength.
- CAMEL-26010: the catalog defaults of xmlSecurity differ from the code, and
secureTag reads the body twice.
- CAMEL-26011: barcodeFormat lists four formats that cannot be encoded.
**Docs fixed:**
- **gzipDeflater:** a note said it is not for gzip files; it writes and
reads exactly the .gz format.
- **zipDeflater:** unmarshal reads any compression level.
- **tarFile:**
- the tar is not compressed;
- the split must be streaming.
- **zipFile and tarFile:** the outgoing CamelFileName is the file name
without its path.
- **protobuf and thrift:**
- unmarshal needs instanceClass in every format;
- protobuf gives a Map after a json unmarshal too.
- **parquetAvro:** unmarshal gives a List or an Iterator, and marshal takes
a List.
- **mimeMultipart:** the content type is multipart/ with the
multipartSubType, mixed by default.
- **pqc:** the payload is held in memory as byte arrays; stream caching does
not change that.
- **avroJackson and protobufJackson, Jackson 2 and 3:** the XML and YAML
examples set unmarshalType to JsonNode, as the Java example does.
**Measured.**
- The validator over the 1204 human-written and 1209 model-written route
files gives the same reports as with #28298.
- All 295 marshal and unmarshal steps in the human-written routes now use a
data format with body types (95.9% with #28298).
**Tests**
- `TextBodyFlowTest.testTheBodyOfBinaryDataFormats`:
- avro with its default library gives a Map, which the file producer
cannot write;
- zipFile, cbor with an unmarshalType, and fory say nothing.
- These pass:
- the 288 tests of camel-yaml-dsl-validator;
- the 265 validator and catalog doc tests of camel-jbang-core;
- the builds of camel-yaml-dsl-maven-plugin and
camel-yaml-dsl-deserializers.
- The answers of camel_catalog_doc stay under 18 000 characters: pgp, the
largest of this group, is 8 649.
_Claude Code on behalf of davsclaus_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]