Commit Graph

279 Commits

Author SHA1 Message Date
Jon Skeet d0286596ee Release 2.6.0
Changes since 2.5.1:

- Dependencies: system-level dependencies updated
- The NuGet package now uses PackageLicenseExpression (but still
  includes the licence file as well).
  Fixes ([#252](https://github.com/cloudevents/sdk-csharp/issues/252)).
- Regenerated protobuf schema using the original filename of
  cloudevents.proto instead of ProtoSchema.proto. An additional
  ProtoSchemaReflection class has been added purely for compatibility.
  Fixes ([#256](https://github.com/cloudevents/sdk-csharp/issues/256)).

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-03-07 11:16:04 +00:00
Jon Skeet b188ee8a8b Regenerate protobuf with the right filename
For some reason we were renaming cloudevents.proto as ProtoSchema.proto, which breaks compatibility with anyone using the original file.

Renaming the reflection class is a breaking change, so I've added an obsolete compatibility class to keep compatibility.
Also updated to Google.Protobuf 3.22.0 (of the general protobuf 22.0 release; protobuf versioning is complex).

Fixes #256

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-03-06 19:51:46 +00:00
Jon Skeet 8999fce15f Update core dependencies
This also removes testing on .NET Core 3.1, which is out of support.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-03-06 19:51:46 +00:00
Jon Skeet 1fe92ab054 Use PackageLicenseExpression instead of PackageLicenseFile
Note that the license file is still embedded in the package (at the root) to conform with the requirement that it's delivered with the software.

Fixes #252

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-03-06 19:51:25 +00:00
dependabot[bot] b660a0ab92 Bump Newtonsoft.Json in /src/CloudNative.CloudEvents.Avro
Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 13.0.1 to 13.0.2.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/13.0.1...13.0.2)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 15:18:31 +00:00
dependabot[bot] 2fbefd1565 Bump Newtonsoft.Json in /src/CloudNative.CloudEvents.NewtonsoftJson
Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 13.0.1 to 13.0.2.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/13.0.1...13.0.2)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 15:11:39 +00:00
Jon Skeet 90bfe356f6 Release 2.5.1
Changes since 2.5.0:

- Dependencies: update dependencies in CloudNative.CloudEvents.Avro
  - Add explicit dependency on Newtonsoft.Json 13.0.1 to avoid
    transitive dependency on a version containing vulnerabilities
  - Update Apache.Avro to 1.11.1

No APIs have changed. This is a patch release as the dependency
changes are very minor (but necessary to avoid vulnerabilities).

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-11-10 09:39:16 +00:00
Jon Skeet 0897d8134b chore: Update CloudNative.CloudEvents.Avro dependencies
- Updated to Apache.Avro 1.11.1 on general principle
- Added explicit dependency on Newtonsoft.Json 13.0.1 to avoid
  taking a transitive dependency on a vulnerable version

Addresses short-term concerns of #245.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-11-09 18:46:19 +00:00
Tim Bussmann b2f4c7bfdc fix markup link
Signed-off-by: Tim Bussmann <timbussmann@users.noreply.github.com>
2022-10-19 20:33:45 +01:00
Jon Skeet ad41c17a43 Update GitHub workflows to use up-to-date environment and actions
Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-10-17 09:44:23 +01:00
Jon Skeet 02f394216e Release 2.5.0
Changes since 2.4.0:

- Dependencies: update dependencies in CloudNative.CloudEvents.AspNetCore:
  - Remove dependency on Microsoft.AspNetCore.Mvc.Core (as we don't use it)
  - Update dependency on Microsoft.AspNetCore.Http to 2.1.34
  - Explicitly add dependency on System.Text.Encodings.Web 6.0.0 to avoid security issue in older version

No APIs have changed, but this is a minor release due to the significant dependency changes.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-10-17 08:45:11 +01:00
Jon Skeet ff0d216387 Update dependencies for CloudNative.CloudEvents.AspNetCore
Fixes #239

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-10-15 07:33:05 +01:00
Jon Skeet 44f82ba07a Release 2.4.0
Changes since 2.3.1:

- Feature: Implement underscore prefixes for AMQP (see history) ([#236](https://github.com/cloudevents/sdk-csharp/pull/236))
- Feature: Allow empty payloads in Kafka ([#224](https://github.com/cloudevents/sdk-csharp/pull/224))
- Feature: Implement conversions to and from JObject/JsonElement in JsonEventFormatter ([#234](https://github.com/cloudevents/sdk-csharp/pull/234), part of [#231](https://github.com/cloudevents/sdk-csharp/issues/231))
- Bug fix: Observe JSON serializer options in JsonEventFormat ([#226](https://github.com/cloudevents/sdk-csharp/pull/226), fixes [#225](https://github.com/cloudevents/sdk-csharp/issues/225))
- Bug fix: Put AvroEventFormatter in the right namespace ([#220](https://github.com/cloudevents/sdk-csharp/pull/220), fixes [#219](https://github.com/cloudevents/sdk-csharp/issues/219))
- Bug fix: Use content headers when parsing HTTP requests/responses ([#222](https://github.com/cloudevents/sdk-csharp/pull/222), fixes [#221](https://github.com/cloudevents/sdk-csharp/issues/221))
- Bug fix: Perform release builds with ContinuousIntegrationBuild=true ([#223](https://github.com/cloudevents/sdk-csharp/pull/223), fixes [#175](https://github.com/cloudevents/sdk-csharp/issues/175))

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-09-08 11:05:16 +01:00
Jon Skeet 304bc0602b Implement underscore prefixes for AMQP
The [binding
specification](https://github.com/cloudevents/spec/blob/main/cloudevents/bindings/amqp-protocol-binding.md)
has changed to prefer `cloudEvents_` over `cloudEvents:`. Previously
`cloudEvents_` wouldn't even have been valid.

With this change, users can either:

- Stick with the default prefix, which doesn't change immediately,
  but which will change in the first release on or after March 1st 2023
- Explicitly use one or other prefix using the explicitly-named
  methods

Other options considered:

- Changing the default now: that's too much of a breaking change. (I
  don't want to take a major version bump for this, and with enough
  time for the change, I think that's okay.)
- Adding a char or string parameter: that would invite using non-standard prefixes
- Adding a Boolean parameter: that would become problematic if we
  ever end up with a third prefix. (Let's hope we don't, but still...)
- Adding an enum and then a parameter for it: feels like overkill

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-09-07 21:58:26 +01:00
Magne Helleborg 81c82e04c6
feat: Allow empty payloads in Kafka, in order to support compaction tombstones (#224)
Signed-off-by: Magne Helleborg <magne.helleborg@gmail.com>
2022-08-30 09:18:51 +01:00
Jon Skeet d9e10ead4f Implement public JsonElement conversions in JsonEventFormatter
The method names are consistent with the ones in
ProtobufEventFormatter and the Json.NET event formatter.

Currently batch conversion is not supported, but we can add that later if requested.

The ConvertToJsonElement method is horribly inefficient at the
moment (serialize then parse); we can consider how to make it more
efficient later if necessary.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-08-18 20:50:26 +01:00
Jon Skeet afaf830ac5 Implement public JObject conversions in JsonEventFormatter
The method names are consistent with the ones in ProtobufEventFormatter.
Currently batch conversion is not supported, but we can add that later if requested.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-08-18 20:50:26 +01:00
Jon Skeet aa7429d7f7 fix: Observe JsonSerializer options for JsonEventFormatter using Newtonsoft.Json
This is the Json.NET equivalent of #225.

Note that not every option in JsonTextWriter is supported; in the future we could potentially introduce some alternative approach to provide more flexibility.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-08-05 07:38:52 +01:00
Jon Skeet b67ac2b556 fix: Observe serialization options in JsonEventFormatter for System.Text.Json
Fixes #225

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-08-05 07:38:52 +01:00
Jon Skeet 0005fc71de Update test package dependencies
Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-08-05 07:38:35 +01:00
Jon Skeet 72be5ff000 fix: Put AvroEventFormatter in the right namespace
We still need it in CloudNative.CloudEvents for backward
compatibility, but we can do that via derivation - which is
pleasantly simple given that the only constructor is parameterless.

Users should update to use the CloudNative.CloudEvents.Avro
namespace at their earliest convenience.

Fixes #219.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-07-26 18:30:29 +01:00
Jon Skeet 8783914863 fix: Perform release builds with ContinuousIntegrationBuild=true
(The build needs to be done this way, not just the packing.)

Fixes #175

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-07-26 18:04:05 +01:00
Jon Skeet 39b691c24a fix: Use content headers when parsing HTTP requests/responses
Fixes #221

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-07-26 18:03:48 +01:00
Jon Skeet 3ce4aa08f2 Release 2.3.1
Changes since 2.3.0:

- Bug fix: ignore the charset when determining the content type for decoding JSON (#216)
- Bug fix: make the NuGet package deterministic (#175)

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-06-29 08:14:13 +01:00
Jon Skeet f74d383c18 fix: Use just the media type to detect JSON, not whole datacontenttype
Fixes #216

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-06-29 07:53:49 +01:00
Jon Skeet ee9d91a398 chore: Tweaks to the sample HttpSend code
In particular, this now generates a random event ID - v1.x used to
do this automatically, but in 2.x it needs to be explicit.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2022-06-27 15:53:31 +01:00
Simon Eßlinger e517ee4755 ci(nuget): make dotnet pack deterministic
by adding the flag `-p:ContinuousIntegrationBuild=true`

Signed-off-by: Simon Eßlinger <github@esslinger.dev>
2022-06-24 07:46:19 +01:00
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