Unable to serialize complex (custom) extension in the expected json format
還沒有人認領這個 Issue。
評估
研究方向
從 core/src/main/java/io/cloudevents/core/impl/BaseCloudEvent.java 第 84 行附近開始,這裡會在序列化期間讀取擴充值。使用報告中所示的自訂 Recipient 擴充功能和 withExtension 多載重現此問題,然後將序列化輸出與預期的巢狀 recipient JSON 進行比較。當自訂擴充物件能夠在沒有 JsonMappingException 的情況下完成序列化,且不會以轉義的 JSON 字串輸出時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
creating a custom extension object implementing CloudEventExtension, when using the extension (customExt) as below, and then serializing the CloudEvent, the serialization for the CloudEvent is failing with JsonMappingException.
CloudEventBuilder.v1()
.withSource(URI.create(source))
.withType(event_type)
.withTime(event_time)
.withId(event.getEventId())
.withDataContentType(contentType)
.withData(eventPayaload)
.withDataSchema(URI.create(XDM_SCHEMA_URI))
.withExtension(DATA_SCHEMA_VERSION_KEY_EXTENSION_NAME, schemaVerExt)
.withExtension(X_ACTION_ID_KEY_EXTENSION_NAME, requestIdExt)
.withExtension(customExt);
here is how the extension looks like. The customExt is the Recipient object
Also, if using the other supported methods withExtension (with key, value) as below, I had to send the string version of the customExt, and then if serialized the output is not in the expected format (see below). It can break our customers event
integrations. Kindly suggest.
expected serialized CloudEvent custom extension
"recipient":{"userid":"9CE048DB5E8F485XXXXXXXXX@AdobeOrg"}
actual serialized CloudEvent custom extension
"recipient":"{\"userid\":\"9CE048DB5E8F485XXXXXXXXX@AdobeOrg\"}"
The serialization is failing while reading extensions here, as I believe the Object type value is not supported.
- 主要語言
- Java
- 星號
- 447
- 分支
- 173
- 平均合併
- 16 小時 42 分鐘
- 30 天內合併 PR
- 2
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
cloudevents/sdk-java 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
cloudevents/sdk-java#731 · 1 個 reaction ·
-
Avro compact deserializer bug - ID set to type可能重新可做 @Taimoo-r 於 76 天前認領,目前沒有進行中的 PR。 未關閉bug
難度 1/5 1-3 小時 新手友好度 88/100
cloudevents/sdk-java#697 · 3 則留言 ·
-
Spring CloudEventMessageConverter produce a null pointer exception if initial message header map is null可能已有人在做 @prashantdotnaagar 於 93 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
cloudevents/sdk-java#689 · 2 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 65/100
cloudevents/sdk-java#660 · 2 則留言 ·
-
cloudevents-bom pulls in jakarta.jakartaee-bom from the parent可能已有人在做 @AdzerKI 於 12 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 25/100
cloudevents/sdk-java#749 ·
查看 cloudevents/sdk-java 的全部 Issue
相似的 Issue
-
status: waiting-for-triage
難度 2/5 1-3 小時 新手友好度 79/100
spring-projects/spring-ai#7206 ·
維護者通常 2 天內回覆
-
bug ci sev-6
難度 2/5 1-3 小時 新手友好度 73/100
-
area/cli
難度 2/5 半天 新手友好度 78/100
quarkusio/quarkus#57623 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
jhipster/prettier-java#1113 ·
維護者通常 2 天內回覆
-
bug follow-up lane:backlog
難度 2/5 1-3 小時 新手友好度 82/100
Sanne/incus-spawn#1576 · 1 則留言 ·
維護者通常 1 天內回覆