davsclaus opened a new pull request, #28943:
URL: https://github.com/apache/camel/pull/28943

   Fixes [CAMEL-26165](https://issues.apache.org/jira/browse/CAMEL-26165).
   
   ## What was wrong
   
   `Event` declared one subtype only, `TaskTimeTrackedUpdatedEvent`. 
`ClickUpWebhookProcessor` reads every request with `MAPPER.readValue(body, 
Event.class)`. So a correctly signed event of any other kind, such as 
`taskCreated`, failed with Jackson `InvalidTypeIdException` before the route. 
The webhook answered 500 and ClickUp kept sending the event again.
   
   Such events arrive when the webhook is set up in ClickUp itself 
(`webhookAutoRegister=false`) with more events. The `events` option itself 
still accepts only `taskTimeTrackedUpdated` (checked in `ClickUpComponent`).
   
   ## What changed
   
   - `Event` has `defaultImpl = GenericEvent.class` and `visible = true` on its 
`@JsonTypeInfo`, and a new `getEvent()` that gives the event kind.
   - New `GenericEvent`: keeps the event kind, `webhook_id`, and all other JSON 
fields as they are in `getProperties()`.
   - An event of another kind now reaches the route as a `GenericEvent`, and 
ClickUp gets 204 when the route succeeds. This follows the first option in the 
JIRA, and the existing doc example, which already has an `otherwise` branch for 
"Unknown Event".
   - The signature check is unchanged and still runs first.
   - `@BodyTypes` of the endpoint: `javaType` is now 
`org.apache.camel.component.clickup.model.Event`, and the description no longer 
says other kinds fail with 500.
   
   ## Tests
   
   `ClickUpWebhookCallTest.testWebhookCallWithEventOfAnotherKind` posts a 
signed `taskCreated` event over netty-http. It checks that the route gets a 
`GenericEvent` with the right kind, webhook id and fields, and that the reply 
is 204. Before the fix, the route got no message (the test failed with 
"Received message count. Expected: <1> but was: <0>"). Module: 6 tests, all 
pass, `-Psourcecheck` clean.
   
   ## Docs and generated files
   
   - `clickup-component.adoc`: a paragraph on `GenericEvent`.
   - Upgrade guide 4.24: a `camel-clickup` entry, since a route now also gets 
events that used to fail before it.
   - Regenerated `clickup.json` (body types) and copied it and the adoc into 
`camel-catalog`.
   
   ## Not changed
   
   - The `events` option still accepts only `taskTimeTrackedUpdated`. Allowing 
all kinds now that they can be delivered is a separate feature choice; left as 
it is.
   - A body that is not valid JSON still fails with 500.
   
   _Claude Code on behalf of Claus Ibsen (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]

Reply via email to