We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi there,
i use cloudevents sdk version 1.0.0, jackson 2.9.8.
when I run the following test, the "data" node appears twice in the resulting JSON (see last println line):
import io.cloudevents.CloudEvent; import io.cloudevents.extensions.ExtensionFormat; import io.cloudevents.format.StructuredMarshaller; import io.cloudevents.format.Wire; import io.cloudevents.format.builder.EventStep; import io.cloudevents.json.Json; import io.cloudevents.v1.Accessor; import io.cloudevents.v1.AttributesImpl; import io.cloudevents.v1.CloudEventBuilder; import io.cloudevents.v1.kafka.HeaderMapper; import org.junit.Test; import java.net.URI; import java.net.URISyntaxException; import java.time.ZonedDateTime; import java.util.UUID; public class ATest { public static class Amount { private int a; public Amount() {} public Amount(int a) { this.a = a; } public int getA() { return a; } public void setA(int a) { this.a = a; } } @Test public void test1() throws URISyntaxException { Amount payload = new Amount(1); CloudEvent<AttributesImpl, Amount> event = CloudEventBuilder.<Amount>builder() .withId(UUID.randomUUID().toString()) .withTime(ZonedDateTime.now()) .withDataContentType("application/cloudevent+json") .withDataschema(new URI("structured_schema")) .withSource(new URI("structured_source")) .withSubject("structured_subject") .withData(payload) .withType("structured_type") .build(); EventStep<AttributesImpl, Amount, byte[], byte[]> builder = StructuredMarshaller.<AttributesImpl, Amount, byte[], byte[]>builder() .mime("Content-Type", "application/cloudevents+json".getBytes()) .map((e) -> Json.binaryEncode(e)) .map(Accessor::extensionsOf) .map(ExtensionFormat::marshal) .map(HeaderMapper::map); Wire<byte[], String, byte[]> wire = builder.withEvent(() -> event).marshal(); System.err.println(new String(wire.getPayload().get())); } }
So the output is something like:
{ "data": { "a": 1 }, "id": "88f599ed-e684-4746-a545-5abdd01ac3a5", "source": "structured_source", "specversion": "1.0", "type": "structured_type", "datacontenttype": "application/cloudevent+json", "dataschema": "structured_schema", "subject": "structured_subject", "time": "2019-11-20T14:03:53.613+01:00", "data": { "a": 1 } }
Could you please tell me what I am doing wrong?
TIA,
Johannes Hampel
The text was updated successfully, but these errors were encountered:
Hi!
Is there a plan to release this issue? I can't use the API cause is generating invalid JSONs.
Thanks
Sorry, something went wrong.
b5bb261
No branches or pull requests
Hi there,
i use cloudevents sdk version 1.0.0, jackson 2.9.8.
when I run the following test, the "data" node appears twice in the resulting JSON (see last println line):
So the output is something like:
Could you please tell me what I am doing wrong?
TIA,
Johannes Hampel
The text was updated successfully, but these errors were encountered: