[ 
https://issues.apache.org/jira/browse/CAMEL-27032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27032:
--------------------------------
    Fix Version/s: 4.24.0

> camel-alibaba-eventbridge: a JSON text body or a Map body without an id fails 
> with "Field id is required"
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27032
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27032
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 4.23.0
>            Reporter: Saravanakumar Selvaraj
>            Assignee: Saravanakumar Selvaraj
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> For a JSON text body, the producer builds the event without an id 
> (AlibabaEventBridgeUtils.toCloudEvent). For a Map body, it sets an id only 
> when the Map has the key id (MapCloudEventValidator.validateAndBuild). The 
> SDK does not generate an id: EventBuilder.build() sets the id that it was 
> given, and EventBridgeClient.putEventsWithOptions validates each event, in 
> which id is required (@Validation(required = true) on CloudEvent.id).
> So putEvents fails with "Field id is required" before a request is sent, for 
> every JSON text body and for every Map body without the key id.
> The doc page says that an omitted id is generated ("auto-generated UUID if 
> omitted"), and its first example sends a JSON text body. The tests of the 
> module use a mock EventBridgeClient, so they do not reach the validation of 
> the SDK.
> Possible fix: the producer sets a generated id, for example a UUID, when a 
> JSON text body or a Map body has none. A test that runs the validation of the 
> SDK would cover it.
> Found while reviewing the option descriptions of camel-alibaba-eventbridge 
> (CAMEL-23832, https://github.com/apache/camel/pull/30193).
> _Claude Code on behalf of saravanakumar1987_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to