Commit Graph

302 Commits

Author SHA1 Message Date
Alexander Batishchev 145486d331 Fixed link to JsonEventFormatter
Signed-off-by: Alexander Batishchev <abatishchev@gmail.com>
2022-06-07 20:22:53 +01:00
Jon Skeet e6f2c4d634 Release 2.3.0
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>
2022-05-31 18:25:41 +01:00
Jon Skeet 92dd95a1b2 docs: Fix spec references in docs
Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-05-31 18:25:41 +01:00
Jon Skeet 0c1a42e868 fix: Handle array segments correctly
Fixes #209

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-05-30 20:12:45 +01:00
Jon Skeet 8f75a9b3cb fix: Fix CI from the master to main change
docs: Update links to refer to main branch in the spec repo (and others)

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-04-08 19:00:03 +01:00
Jon Skeet 1d077d4e57 docs: Initial docs for contributing and the maintainer list
The contribution guide is largely copied from
https://github.com/cloudevents/sdk-java/blob/master/CONTRIBUTING.md
with suitable changes.

Fixes #204

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-04-07 06:38:13 +01:00
Jon Skeet b1f29cf25b Support data content type inference
- 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>
2022-02-25 07:11:13 +00:00
Jon Skeet 8d3da7d1e8 Reject "data" as the name of an extension attribute
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>
2022-02-23 16:22:59 +00:00
Jon Skeet 409982e9e9 Release 2.2.0 (with Protobuf 2.0.0-beta.1)
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>
2022-02-02 07:26:07 +00:00
Jon Skeet 0349eeb274 feat: Add a Protobuf event formatter
Further features may be added later, e.g. convenience methods.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-02-01 09:44:35 +00:00
Jon Skeet bf27ac4be3 fix: Validate that source is non-empty
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>
2022-02-01 09:44:35 +00:00
Jon Skeet c4a938c24c fix: Minor tweaks to the System.Text.Json JsonEventFormatter for compliance
- 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>
2022-01-20 07:29:29 +00:00
Jon Skeet d61aa171d1 Replace AppVeyor badge with GitHub Actions one
Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-01-19 16:49:28 +00:00
Jon Skeet 9cf04dc4ba fix: Minor tweaks to the Json.NET JsonEventFormatter for compliance
- 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>
2022-01-19 08:30:29 +00:00
Jon Skeet 4f13307d66 Update to .NET 6 SDK to build and netcoreapp3.1 for test
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>
2022-01-12 07:09:02 +00:00
Jon Skeet 16fb2a24c9 Remove AppVeyor configuration
We're fine with GitHub actions, and there's no real benefit in
having both CI environments.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-01-12 07:09:02 +00:00
dependabot[bot] 34dd366d6f Bump Apache.Avro in /src/CloudNative.CloudEvents.Avro
Bumps [Apache.Avro](https://github.com/apache/avro) from 1.10.2 to 1.11.0.
- [Release notes](https://github.com/apache/avro/releases)
- [Commits](https://github.com/apache/avro/compare/release-1.10.2...release-1.11.0)

---
updated-dependencies:
- dependency-name: Apache.Avro
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 09:31:09 +00:00
Jon Skeet 42b723d844 docs: Update one sample to show a relative URI for Source
(We want to make it clear that Source can be relative or absolute.)

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-08-06 11:04:18 +01:00
Ofir Shapira 8e914a3599 Update guide.md
Signed-off-by: Ofir Shapira <ofir.shapira@como.com>
2021-08-05 12:49:46 +01:00
Jon Skeet 33d1d21370 All packages release 2.1.1
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>
2021-07-21 07:45:03 +01:00
iron9light 10114fb707 "Nullable" package should be added as a development dependency
Signed-off-by: iron9light <iron9light@gmail.com>
2021-07-20 08:07:41 +01:00
Jon Skeet bedad89613 All packages release version 2.1.0
New features:

- Nullable reference type annotations ([#170](https://github.com/cloudevents/sdk-csharp/issues/170))
- More batch support for HttpListener ([#166](https://github.com/cloudevents/sdk-csharp/issues/166))
- CloudEvent.CopyToHttpResponse extension method (part of [#148](https://github.com/cloudevents/sdk-csharp/issues/148))

Other improvements:

- More informative error message for non-CE HTTP requests ([#165](https://github.com/cloudevents/sdk-csharp/issues/165))

Bug fixes:

- Various small XML docs typos ([commit](626089ea1e))
- Don't set the content type to JSON in HttpListener when it's not set in the CloudEvent ([commit](18e13635fe))

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-14 18:52:56 +01:00
Jon Skeet e7ebdd7c1c Enable nullable reference types for unit test project
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet bb8f4a8d13 Enable nullable reference types for System.Text.Json formatter
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 1c017d30f4 Enable nullable reference types for Json.NET formatter
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 135232a27c Enable nullable reference types for MQTT
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 0d8a7288fd Enable nullable reference types for Kafka
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 9a76e2c16a Enable nullable reference types for Avro
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 56394bd200 Enable nullable reference types for ASP.NET Core
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 6fedcec3de Enable nullable reference types for AMQP
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 8f43ba1038 Enable nullable reference types for CloudNative.CloudEvents
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-07-10 07:03:43 +01:00
Jon Skeet 767b0d2acb Add a netstandard2.1 target framework to all production projects
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>
2021-07-10 07:03:43 +01:00
Jon Skeet 7fba373167 Adjust documented processes based on expectations of releases.
(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>
2021-07-10 07:03:22 +01:00
Jon Skeet d4ff2b596e Add methods to copy CloudEvents to HttpResponse
One part of #148

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-30 07:44:33 +01:00
Jon Skeet 2554006b23 Add ToCloudEventBatch to HttpListenerExtensions
Fixes #166

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-30 07:44:33 +01:00
Jon Skeet 626089ea1e Fix XML documentation for existing ToCloudEventBatch methods
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-30 07:44:33 +01:00
Jon Skeet a2a4c71880 Tests for CopyToHttpListenerResponseAsync
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-30 07:44:33 +01:00
Jon Skeet 18e13635fe Remove accidental content type setting in HttpListenerExtensions
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-30 07:44:33 +01:00
Jon Skeet 666ee247c0 Add IsCloudEventBatch to HttpListener
Towards #166

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-30 07:44:33 +01:00
Jon Skeet c0687fdcfe Provide an informative error message for non-CE HTTP requests
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>
2021-06-29 07:40:23 +01:00
Jon Skeet 7985d47eb6 All packages release version 2.0.0
There have been no API changes since 2.0.0-rc.1

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-15 09:58:36 +01:00
Peter Dekkers 927d20ed36
Update CloudEventsSpecVersion.cs (#163)
Fixed small typo

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-14 08:50:40 +01:00
Jon Skeet d57de5ad40 All packages pre-release version 2.0.0-rc.1
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>
2021-06-07 09:28:55 +01:00
Jon Skeet 617bafc36d Avoid redundant data copy in BinaryDataUtilities
(Will self-merge as this was suggested by Josh in the review of #153.)

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-07 09:23:08 +01:00
Jon Skeet cac8edf61c Build with the .NET 5.0 SDK
Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-07 09:02:05 +01:00
Jon Skeet 19afd42806 Improve the ASP.NET Core sample
- 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>
2021-06-07 09:02:05 +01:00
Jon Skeet e772c1b110 Use ReadOnlyMemory<byte> in CloudEventFormatter
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>
2021-06-05 22:13:07 +01:00
Jon Skeet a91d138b96 Remove all web hook code (probably temporarily)
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>
2021-06-03 18:18:21 +01:00
Jon Skeet dbe6163ad6 Remove distributed tracing extension attributes
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>
2021-06-03 18:17:19 +01:00
Jon Skeet fa7dee1aac Provide more information during attribute name validation
Fixes #158

Signed-off-by: Jon Skeet <jonskeet@google.com>
2021-06-03 18:16:26 +01:00