Commit Graph

309 Commits

Author SHA1 Message Date
Jon Skeet 14cb9f5c02 Fix Kafka test which was broken by xUnit upgrade
The production code behavior hasn't changed here, but Assert.Equal used to pass when presented with an empty string and an empty byte array.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2024-08-02 09:43:18 +01:00
Jon Skeet d9831a393d Update unit test parameter nullability
Signed-off-by: Jon Skeet <jonskeet@google.com>
2024-08-02 09:43:15 +01:00
Jon Skeet cdbd54a92a Update dependencies
Many of these are just build/test/packaging, but customer-relevant dependency updates are:

- AMQPNetLite and AMQPNetLite.Serialization: 2.4.2 => 2.4.11
- System.Text.Encodings.Web: 6.0.0 => 8.0.0 (only used in netstandard2.0 and netstandard2.1 targets)
- Apache.Avro: 1.11.1 => 1.11.3
- Newtonsoft.Json: 13.0.2 => 13.0.3
- Google.Protobuf: 3.22.0 => 3.27.3
- Confluent.Kafka: 1.6.3 => 1.9.3 (see #297 for consideration of a bump to 2.x)

Signed-off-by: Jon Skeet <jonskeet@google.com>
2024-08-02 08:07:07 +01:00
Jon Skeet 830415d936 Update CloudNative.CloudEvents.Mqtt to MQTTnet version 4.3.6.1152
This involves a new major version of CloudNative.CloudEvents.Mqtt.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2024-08-01 16:20:55 +01:00
Jon Skeet c0e3f9ac19 Prepare for a separate major version of CloudNative.CloudEvents.Mqtt
This more fine-grained way of referring to the versions will allow us to still only change Directory.Build.props just before a release, but have separate major versions flow from that.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2024-08-01 16:20:55 +01:00
dependabot[bot] 77d5a37c33 build(deps): Bump System.Text.Json
Bumps System.Text.Json from 5.0.2 to 8.0.4.

---
updated-dependencies:
- dependency-name: System.Text.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-10 08:01:39 +01:00
James Thompson 0c44aade1d
#286 Add in a framework reference for net8 (#289)
Signed-off-by: James Thompson <thompson.tomo@outlook.com>
2024-04-08 07:58:34 +01:00
Jon Skeet 684698c09d Add compatibility checks
Signed-off-by: Jon Skeet <jonskeet@google.com>
2024-03-26 16:46:52 +00:00
Safia Abdalla 6385133391
Test null check in Timestamps.TryParse and document parameters (#285)
Signed-off-by: Safia Abdalla <safia@safia.rocks>
2024-03-08 09:35:36 +00:00
Safia Abdalla 3b78a265f5
Update ASP.NET Core sample to use minimal host (#283)
* Update ASP.NET Core sample to use minimal host

Signed-off-by: Safia Abdalla <safia@safia.rocks>
2024-03-06 18:58:15 +00:00
Jon Skeet 4fec77c9e9 Add a code of conduct document
This just refers to the CNCF code of conduct instead of containing
the details directly, so that we don't need to change anything if
the CNCF document changes.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2024-03-06 16:34:13 +00:00
James Thompson 915b465129 #278 Only include packages not part of framework
Signed-off-by: James Thompson <thompson.tomo@outlook.com>
2024-02-08 18:33:25 +00:00
Jon Skeet 47a95c2152 chore: Only include the System.Memory dependency in netstandard builds
Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-28 15:35:11 +00:00
Jon Skeet 0a80c56826 chore: Fix null reference complaints under .NET 8.0
Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-28 15:35:11 +00:00
Jon Skeet 623e51f387 chore: Target .NET 8.0 (for now) in production packages
This commit *just* adds .NET 8 to the target framework list, in all packages. The code will not build at this point, due to nullability checking. That will be fixed in a later commit, but separating the two makes it easier to review.

Later we may well decided to *build* a .NET 8 target, but not pack it - unless we see concrete benefits from doing so over letting .NET 8 use the existing netstandard2.1 target.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-28 15:35:11 +00:00
Jon Skeet 719f4efbcd chore: Upgrade to .NET 8
This commit:

- Adds a global.json file to declare the required SDK version
- Updates CI to install both .NET 6 and .NET 8
- Updates the test projects to test with both .NET 6 and .NET 8

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-28 15:35:11 +00:00
Jon Skeet 295c12445e chore: Fix editorconfig-based warnings
(It can be hard to get these to show up without opening the code
file itself. I've opened all files within VS, so we *should* be
"clean" now.)

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-14 12:59:42 +00:00
Jon Skeet ae75b32c28 chore: Fix whitespace in all files
These changes were generated automatically by running "Analyze and Code Cleanup".

Showing a diff ignoring whitespace shows the removal of the UTF-8 BOM from three files, but that's all.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-14 12:20:57 +00:00
Jon Skeet b04c141707 chore: Remove/sort using directives
These changes were generated automatically by running "Analyze and Code Cleanup"

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-14 12:20:57 +00:00
Jon Skeet c97b1631d7 chore: Add editorconfig
(This will be applied in subsequent commits.)

One potentially-controversial aspect of this editorconfig is the use of a space after casting. The code is currently very inconsistent, but has a space after the cast more often than not (the diff is smaller with it set to true than false)... it's also consistent with the style I personally use in multiple other repositories. While I'm the main contributor, it probably makes sense to stick to that.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-11-14 12:20:57 +00:00
Doug Davis 6f484339e8 add link to our security mailing list
Signed-off-by: Doug Davis <dug@microsoft.com>
2023-10-16 14:32:45 +01:00
Doug Davis e28d8883df Governance docs per CE PR 1226
Signed-off-by: Doug Davis <dug@microsoft.com>
2023-09-28 13:39:08 +01:00
Jon Skeet df5dc173df Update documentation as per https://github.com/cloudevents/spec/pull/1226
Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-09-15 10:30:34 +01:00
Jon Skeet 7999942334 Release 2.7.1
Changes since 2.7.0:

- Prevent string resource lookup if not required. Fixes ([#264](https://github.com/cloudevents/sdk-csharp/issues/264)).

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-09-04 09:16:37 +01:00
Campbell Harding-Deason afb9b857e7
Prevent string resource lookup if not required (#265)
Signed-off-by: Campbell Harding-Deason <campbell.harding-deason@firstaml.com>
2023-09-01 06:46:53 +01:00
Jon Skeet 0c0169f4fd Release 2.7.0
Changes since 2.6.0:

- Add the ability to specify a custom serializer for Avro.
  Fixes ([#261](https://github.com/cloudevents/sdk-csharp/issues/261)).

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-07-31 16:30:12 +01:00
Kirner- 8ae17d77ec Add optional IGenericRecordSerializer to Avro formatter
Signed-off-by: Kirner- <kirner10@gmail.com>
2023-07-27 11:38:18 +01:00
Jon Skeet 88f7225313 Check out submodules in GitHub actions
Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-04-21 08:27:33 +01:00
Jon Skeet 4dd0f93b55 First pass at data-driven conformance tests
These use the test files from
https://github.com/cloudevents/conformance/tree/format-tests/format,
which is included via a submodule called conformance.

The XML tests are not included in this commit, as the C# XML formatter
has not been reviewed yet.

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-04-21 08:27:33 +01:00
Jon Skeet 8887ed21f9 Add submodule for conformance tests
Eventually we'll be able to change the branch to main

Signed-off-by: Jon Skeet <jonskeet@google.com>
2023-04-21 08:27:33 +01:00
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