davsclaus opened a new pull request, #28410:
URL: https://github.com/apache/camel/pull/28410
_Claude Code on behalf of davsclaus_
This group adds the catalog body types (CAMEL-24961) for twelve SaaS
components: salesforce, servicenow, zendesk, workday, wordpress, whatsapp,
twilio, stripe, braintree, box, clickup and cm-sms. Each change is an
`@BodyTypes` annotation on the Endpoint, plus the JSON it generates and the
catalog copy. The stripe doc page had its example corrected.
**What the catalog says now**
| Component | Consumer | Producer input | Producer output |
|---|---|---|---|
| salesforce | a Map or the `sObjectClass` object for a push topic; a
`PlatformEvent`; a Map of the changed fields for a change event; an Avro
record, a POJO or JSON text for pubSubSubscribe | a generated DTO (sent as
JSON), or JSON text, bytes, a stream or a file as is; the description lists
what apexCall, bulk, composite, the collections, pubSubPublish and raw need |
by operationName: `CreateSObjectResult`; unchanged for update and delete; the
DTO for get; the QueryRecords object, or a stream or an iterator, for query; a
stream for raw and getBlobField; a List for the collections |
| servicenow | | a Map by default, an object of the request model, or JSON
text with a String model; a stream for an attachment upload | a Map, a List of
Maps, objects of the model, or JSON text; an InputStream for the content of an
attachment; unchanged for delete |
| zendesk, twilio, braintree, box | one message per element of the result: a
`Ticket`, a twilio resource, a `BoxEvent`, and so on | the `inBody` parameter
of the method, of its type | the return value of the SDK method: a model
object, a lazy iterable for the lists (`PagedIterable`, `ResourceSet`,
`ResourceCollection`), a braintree `Result`, a `Boolean` for the twilio delete,
null for void methods |
| workday | | `any`: the path and the options make the URL | the JSON text
Workday answers (format json) |
| wordpress | a `Post` or a `User` per item | a `Post` or a `User` to create
or update | the `Post` or `User` WordPress answers |
| whatsapp | | one of the seven `*Request` classes | a `MessageResponse`, or
unchanged when there is none |
| clickup | a `TaskTimeTrackedUpdatedEvent`, through camel-webhook; the
reply of the route is not sent | | |
| stripe | | a Map, or a JSON object as text, of the parameters; not read
for retrieve, delete and cancel | the `com.stripe.model` object, or a
`*Collection` for list |
| cm-sms | | an `SMSMessage` | unchanged |
The API components (zendesk, twilio, braintree, box) do not convert the body
today: a body of another type than the parameter fails with "argument type
mismatch". PR #28364 makes them convert it, and the description holds both ways.
**Checked at runtime.** Every call went to a local fake, with dummy
credentials and dead credential environment variables. The setups:
- **salesforce:** the MockWebServer of the module, and its streaming
consumer tests.
- **servicenow, zendesk, braintree, whatsapp, stripe, cm-sms:** a local HTTP
server.
- **twilio:** a fake HttpClient.
- **box:** a request interceptor.
- **workday:** a local HTTPS server.
- **wordpress:** the mock server of the module.
- **clickup, and the whatsapp webhook:** camel-webhook on netty-http, with a
valid HMAC for clickup.
The tests sent text, bytes, a stream, a file, a Map, a POJO and no body, and
are not part of the PR.
Not run:
- the salesforce pub/sub (gRPC), bulk, composite tree and batch, and
analytics operations;
- the Stripe resources other than customers;
- some Box, Zendesk, Twilio and Braintree methods, described from their
generated signatures.
**Choices**
- salesforce uses byOption on the families of `operationName`, as minio
does. rawPayload, streamQueryResult and notFoundBehaviour are also component
options, so the validator answers unknown where they could be set on the
component.
- The lazy SDK iterables of the API components count as `iterator`.
- whatsapp is producer only, so what its webhook gives (the JSON as text)
cannot be in its body types.
**Doc fix**
- **stripe:** the REST example sent the body of `rest:post`, a stream, to
Stripe, which fails. It now converts it to a String first, in Java, XML and
YAML.
PR #21800 changes the generated JSON of salesforce and servicenow. This PR
only adds the `bodyTypes` block to them.
**Bugs found, not fixed here.** The JIRAs, one per component, will follow.
- **salesforce:**
- A Map body, or a POJO that is not a DTO, on a REST operation is sent as
its toString (`{Name=x}`), with no error.
- raw with a Map body sends a POST with an empty body.
- When the response of the SObject collections cannot be parsed,
`Optional.get()` fails on the HTTP client thread. The exchange then completes
with no exception and a null body.
- The rawPayload option says "raw payload String", but the producer gives
an InputStream.
- **servicenow:** `AbstractServiceNowProcessor.unwrap` uses
`model.isInstance(Map.class)`, which is always false. It is harmless.
- **zendesk:** the documented syntax `zendesk:methodName` fails to create
the endpoint ("ZendeskApiName does not have any constant with value: "). Only
`zendesk:default/getTicket` works, so the YAML example of the page does not
work.
- **box:** the doc example from a file consumer to `files/upload` fails, as
the GenericFile is not converted. #28364 fixes it.
- **workday:**
- The Basic auth header of the token request is built with
`Arrays.toString` of the base64 bytes (`Basic [89, 50, ...]`).
- The token is cut from the JSON by fixed offsets, so it is wrong for any
other layout.
- **wordpress:** JSON text or a Map to insert or update fails with a bare
"Please define an object to create".
- **whatsapp:**
- The webhook fails with an ArrayIndexOutOfBoundsException for an empty
query value, and does not URL-decode the values.
- A missing CamelHttpMethod header fails with a NullPointerException.
- The producer logs every response body at INFO.
- **clickup:**
- A bad or missing signature answers 500, not 401 or 403.
- An event of another kind than time-tracked also answers 500, so ClickUp
keeps retrying it.
- **stripe:**
- Bytes and streams are not converted.
- The CamelStripeOperation header is documented but never read.
- update, capture, delete and cancel make an extra retrieve call first.
- **cm-sms:**
- The `from` of the `SMSMessage` is never sent.
- A validation failure reads "No body available of type: SMSMessage but
has type: SMSMessage", and the violations are logged only at DEBUG.
**Local checks**
- The changed modules build, with no change to the generated files after the
build.
- The catalog copies equal their modules.
- camel-catalog, camel-yaml-dsl-validator and camel-jbang-core tests pass.
- The Endpoint and Component DSLs regenerate with no change.
🤖 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]