Skip to content

Abstract JSON serialization behind installable serializer packages#1147

Draft
MMonrad wants to merge 1 commit into
eventflow:develop-v1from
MMonrad:feature/serializer-abstraction
Draft

Abstract JSON serialization behind installable serializer packages#1147
MMonrad wants to merge 1 commit into
eventflow:develop-v1from
MMonrad:feature/serializer-abstraction

Conversation

@MMonrad

@MMonrad MMonrad commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Core EventFlow no longer depends on Newtonsoft.Json. JSON serialization is now provided by separate, client-selectable packages:

  • EventFlow.Serialization.NewtonsoftJson (AddNewtonsoftJson)
  • EventFlow.Serialization.SystemTextJson (AddSystemTextJson)

Core changes (breaking):

  • Removed JsonSerializer, SingleValueObjectConverter, IJsonOptions/JsonOptions/ ChainedJsonOptions, JsonOptionsExtensions and ConfigureJson from core.
  • Dropped the Newtonsoft.Json package reference.
  • Added ThrowingJsonSerializer as the default IJsonSerializer so a missing serializer registration fails fast with an actionable message.
  • Removed Newtonsoft serialization attributes from core/sub-package types ([JsonIgnore] on Metadata/SnapshotMetadata, [JsonConverter] on CacheKey, [JsonProperty] on MongoDB data models, [JsonConverter] on example ids). These were inert under the dictionary/BSON contracts.
  • InMemoryEventPersistence now uses the injected IJsonSerializer.

Behavior preserved: SingleValueObjects keep serializing as objects by default (the bare-value SingleValueObjectConverter remains an opt-in), so existing event/snapshot stores remain readable.

Added a provider-agnostic TestSuiteForJsonSerializer conformance suite; both serializer packages pass it. Test bootstrapping and EventFlow.Tests updated to register Newtonsoft explicitly.

Note: EventFlow.AspNetCore is not part of the solution and is left untouched.

@MMonrad MMonrad marked this pull request as draft June 25, 2026 17:40
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@MMonrad MMonrad force-pushed the feature/serializer-abstraction branch from fcedc31 to 58013d9 Compare June 25, 2026 18:25
@MMonrad MMonrad force-pushed the feature/serializer-abstraction branch from 58013d9 to 7e2b29d Compare June 26, 2026 06:26
@MMonrad MMonrad force-pushed the feature/serializer-abstraction branch from 7e2b29d to bf44a87 Compare June 26, 2026 06:27
@MMonrad MMonrad force-pushed the feature/serializer-abstraction branch from bf44a87 to f8d418e Compare June 26, 2026 06:51
Core EventFlow no longer depends on Newtonsoft.Json. JSON serialization is
now provided by separate, client-selectable packages:

- EventFlow.Serialization.NewtonsoftJson  (AddNewtonsoftJson)
- EventFlow.Serialization.SystemTextJson  (AddSystemTextJson)

Core changes (breaking):
- Removed JsonSerializer, SingleValueObjectConverter, IJsonOptions/JsonOptions/
  ChainedJsonOptions, JsonOptionsExtensions and ConfigureJson from core.
- Dropped the Newtonsoft.Json package reference.
- Added ThrowingJsonSerializer as the default IJsonSerializer so a missing
  serializer registration fails fast with an actionable message.
- Removed Newtonsoft serialization attributes from core/sub-package types
  ([JsonIgnore] on Metadata/SnapshotMetadata, [JsonConverter] on CacheKey,
  [JsonProperty] on MongoDB data models, [JsonConverter] on example ids).
  These were inert under the dictionary/BSON contracts.
- InMemoryEventPersistence now uses the injected IJsonSerializer.

Behavior preserved: SingleValueObjects keep serializing as objects by default
(the bare-value SingleValueObjectConverter remains an opt-in), so existing
event/snapshot stores remain readable.

Added a provider-agnostic TestSuiteForJsonSerializer conformance suite; both
serializer packages pass it. Test bootstrapping and EventFlow.Tests updated to
register Newtonsoft explicitly.

Note: EventFlow.AspNetCore is not part of the solution and is left untouched.
@MMonrad MMonrad force-pushed the feature/serializer-abstraction branch from f8d418e to 91b895e Compare June 26, 2026 07:45
@MMonrad MMonrad deployed to develop June 26, 2026 07:45 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants