Changes since 2.2.0:
- Bug fix: BinaryDataUtilities.AsArray misbehavior with array segments ([#209](https://github.com/cloudevents/sdk-csharp/issues/209))
- Bug fix: Links within XML documentation corrected after spec repo change
- Feature: Reject "data" as a context attribute name (spec has been clarified for this)
- Feature: Support Data content type inference in event formatters
- The JsonEventFormatter classes infer "application/json" for all data
- Feature: CloudNative.CloudEvents.Protobuf is now GA (same version as other packages)
Signed-off-by: Jon Skeet <jonskeet@google.com>
- New methods in CloudEventFormatter to support inference
- JsonEventFormatter infers a content type of application/json for non-binary data
- All transports use the inferred content type when formatting in binary mode
- Documentation for both formatters and bindings has been updated
Signed-off-by: Jon Skeet <jonskeet@google.com>
This isn't currently in the CloudEvents spec, but was agreed at
the meeting of 2022-02-03, on the grounds that the most prominent
event formt - JSON - already *implicitly* prohibits it.
We should wait until the spec is updated before merging this.
Signed-off-by: Jon Skeet <jonskeet@google.com>
Changes in this release:
- Bug fix: the "source" attribute is now validated to be non-empty
- Bug fix: the JSON event formatters comply with the clarified JSON event format spec
- Dependency: Apache.Avro dependency updated to 1.11.0
- Feature: New package CloudNative.CloudEvents.Protobuf, released as 2.0.0-beta.1
Signed-off-by: Jon Skeet <jonskeet@google.com>
URI references can be empty - we have a test proving that. But the source attribute is required to be non-empty, so we should validate that.
This bug fix is a breaking change for anyone who was previously creating (and then validating) CloudEvent instances with a present-but-empty source.
However, their events were already broken, and we'd expect them to cause issues with other consumers (at least any performing comprehensive validation).
Signed-off-by: Jon Skeet <jonskeet@google.com>
- Make "JSON media type detection" configurable, and default to */json and */*+json
- Default to JSON content type (including making it present in the serialized event)
- Make a "binary vs non-binary" distinction as the first part of serialization (instead of as a fallback)
- Deserialize string data values regardless of content type
- Prohibit non-string data values for non-JSON content types
Signed-off-by: Jon Skeet <jonskeet@google.com>
- Make "JSON media type detection" configurable, and default to */json and */*+json
- Default to JSON content type (including making it present in the serialized event)
- Make a "binary vs non-binary" distinction as the first part of serialization (instead of as a fallback)
- Deserialize string data values regardless of content type
- Prohibit non-string data values for non-JSON content types
Signed-off-by: Jon Skeet <jonskeet@google.com>
This requires a few nullable-reference-type overrides in tests where
we're absolutely confident they won't be null (and if we're wrong,
an NRE is fine to break the test).
Signed-off-by: Jon Skeet <jonskeet@google.com>
Bug fix ([#77](https://github.com/cloudevents/sdk-csharp/pull/177)): dependency on the
`Nullable` package was not declared with `PrivateAssets=all`,
leading to that showing up as a dependency. This would break users
who explicitly have a dependency on an older version of `Nullable`.
This fix shouldn't break anyone, as far as we're aware.
Signed-off-by: Jon Skeet <jonskeet@google.com>
We probably only need it in the Core project to start with, but it feels best to be consistent.
We probably want this regardless of the rest of the PR for nullability.
Signed-off-by: Jon Skeet <jonskeet@google.com>
(Maintaining separate package versions now feels like it would be
really awkward, with limited benefit and even some downsides.)
Signed-off-by: Jon Skeet <jonskeet@google.com>
Fixes#165
While this could potentially be done without the duplication (e.g.
in HttpUtilities) it's not clear that it's worth doing that, and it
can be done later if necessary.
Signed-off-by: Jon Skeet <jonskeet@google.com>
This is the first release candidate for version 2.0.0.
Most significant changes since 2.0.0-beta.3:
- Web hook code removed for the moment
- See https://github.com/cloudevents/spec/issues/781 for background
- CloudEventJsonInputFormatter removed from ASP.NET Core package
- More work is required before we want to commit to this; code is in the sample for now
- Distributed tracing extension attributes removed for the moment
- See https://github.com/cloudevents/spec/pull/751 for background
- Use `ReadOnlyMemory<byte>` instead of `byte[]` in `CloudEventFormatter`
The last of these is the biggest change, and a breaking one.
`BinaryDataUtilities` has been modified to provide helper methods.
Signed-off-by: Jon Skeet <jonskeet@google.com>
- Test with both ASP.NET Core 3.1 and 5.0
- Add an API method to generate an event
- Change the launch settings to launch directly instead of with IIS Express
If #153 is merged before this, we'll need to modify it very slightly
as the encoding method will return `ReadOnlyMemory<byte>` instead of
`byte[]`, but that's easy enough to do.
Signed-off-by: Jon Skeet <jonskeet@google.com>
This sometimes feels a little cumbersome, with conversions that will
*sometimes* involve copying data, but leaves room for optimization
later and is a more flexible API in the long term.
Signed-off-by: Jon Skeet <jonskeet@google.com>
There's discussion about exactly what CloudEvent web hooks should
look like: https://github.com/cloudevents/spec/issues/781
We can remove the code until that's resolved.
Fixes#154
Signed-off-by: Jon Skeet <jonskeet@google.com>
The future of these is currently in doubt - see https://github.com/cloudevents/spec/pull/751
(We can revert this commit later if they come back.)
Fixes#125
Signed-off-by: Jon Skeet <jonskeet@google.com>