cloudevents / sdk-java

Java SDK for CloudEvents
https://cloudevents.github.io/sdk-java/
Apache License 2.0
390 stars 159 forks source link

Change type of source attribute from URI to String #601

Closed gmuth closed 9 months ago

gmuth commented 9 months ago

The source type should not be limited to URI. https://github.com/cloudevents/sdk-java/blob/main/api/src/main/java/io/cloudevents/CloudEventAttributes.java

pierDipi commented 9 months ago

Can you expand on why?

source attribute in the spec is a URI-Reference type https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#source-1 (type system https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#type-system)

gmuth commented 9 months ago

I missed that important bit. I thought the spec required string. So from a spec point of view it makes sense to keep URI. However a lot of examples and explanations don't adhere to this type. E.g.: https://spring.io/blog/2020/12/23/cloud-events-and-spring-part-2 So I guess for the sdk-java it's okay to strictly implement the spec. The only argument I now find is resilience to support non-spec source values as well.

On the other hand I think defining string in the spec makes more sense - however this I would have to address to another audience.