sdk-java
sdk-java copied to clipboard
Validation error due to specVersion instead of specversion in the event payload
Versions:
implementation group: 'io.cloudevents', name: 'cloudevents-spring', version: '2.4.0'
implementation 'io.cloudevents:cloudevents-json-jackson:2.4.0'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4'
Example payload:
{"data":{"value":"AN_EXAMPLE_JSON_PAYLOAD","id":"228ad7d1-dd16-4fd5-a02e-4b4bdcb7eaed","source":"service-test","type":"dummy.event","subject":null,"time":null,"specVersion":"V1","dataContentType":"application/cloudevents+json","dataSchema":null,"extensionNames":[],"attributeNames":["datacontenttype","specversion","id","source","type"]}
Getting following error:
org.springframework.messaging.MessageHandlingException: error occurred in message handler [bean 'serviceActivator.handler' for component 'serviceActivator']; nested exception is io.cloudevents.core.format.EventDeserializationException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Missing mandatory specversion attribute
I am not sure if this is a known issue of if there is anything missing in the documentation to properly serialize the base event attributes. Would appreciate any help here.
Regards, Giriraj
Hi @giriraj-hh, is a fix something you can contribute?
@giriraj-hh - Can you clarify where the "example payload" is coming from? .. CloudEvent context attribute names aren't camelCase'd, so "specVersion" doesn't mean the same thing as "specversion".