F# Event-Union Contract Encoding with versioning tolerant converters supporting System.Text.Json and Newtonsoft.Json
NOTE: These release notes summarize the more detailed ones per -rc
increment included in the CHANGELOG.md
TL;DR this release adds features and applies some associated tweaks with the following objectives:
StreamId
to go with the lower-level StreamName
abstraction, which forms part of the Equinox V4 Programming Model, streamlining how identity types get mapped to stream namesbyte[]
Event Bodies to System.ReadOnlyMemory
- this is the default body types for most Equinox V4 stores, and for Propulsion V3Newtonsoft.Json
dependency to silence security scannersUnion
and TypeSafeEnum
(which started life as independent implementations per concrete Codec) to the core moduleFSharpFunc
->Func
, System.Tuple
->System.ValueTuple
)Codec.Create
: Exposed low level overload for infrastructure useCore.EventData/TimelineEvent/EventCodec.Map
: Exposed building blocks for mapping event envelopes and/or codecs over Body Format types #77
Core.TimelineEvent.Create
: Add overload to create an ITimelineEvent
given the additional properties to go with a set of baseline data from an IEventData
Core.EventData/TimelineEvent
: Exposed default ctors #83
NewtonsoftJson.StringEnumConverter.Create
: Small wrapper to smooth construction syntax #111
NewtonsoftJson.Serdes.Deserialize<'T>(Newtonsoft.Json.Linq.JObject)
: One liner #111
NewtonsoftJson.StringIdConverter
: Converter for StringId
#119
Serdes
: Add SerializeToStream
and DeserializeFromStream
#83 :pray: @deviousasti
StreamId
: type-tagged wrapper for the streamId portion of a StreamName
#100
StreamName.Category
+ category
: Extracts the category portion of a streamName #85
StreamName.Category
: covers aspects of StreamName
pertaining to the {category}
portion (mainly moved from StreamName
.* equivalents; see Changed) #100
StreamName.Split
: Splits a StreamName into its {category}
and {streamId}
portions, using StreamId
for the latter. Replaces CategoryAndId
#100
StreamName.tryFind
: Helper to implement Stream.tryDecode
/ Reactions.For
pattern (to implement validation of StreamId format when parsing StreamName
s). (See README) #100
StringId, Comparable
: Base types for Strongly Typed Ids with string renditions #119
SystemTextJson.CodecJsonElement
: Maps Unions to/from Events with JsonElement
Bodies as SystemTextJson.Codec
did in in 2.x
#75
SystemTextJson.Options.Create
: Add rejectNullStrings
option, which wires in a RejectNullStringConverter
#87 :pray: @nordfjord
SystemTextJson.StringIdConverter
: Converter for StringId
#119
SystemTextJson.StringIdOrDictionaryKeyConverter
: Converter for StringId
that enables Dictionary
values using a StringId
-derived type as a key to be used as a JSON Object Key #116
SystemTextJson.ToUtf8Codec
: Adapter to map from JsonElement
to ReadOnlyMemory<byte>
Event Bodies (for interop scenarios; ideally one uses SystemTextJson.Codec
directly in the first instance) #75
TimelineEvent.Size
: Enables stores to surface the stored size at the point of loading #82
TypeSafeEnum.caseValues<'t>
: Yields all values of a union (that is a TypeSafeEnum
) #115
TypeSafeEnum.tryParseF/parseF
: parameterizes matching of the Union Case name (to enable e.g. case insensitive matching) #101
Union
: Exposed internal type, featuring isUnion
, isNullary
, and caseName
(that's not tied to TypeSafeEnum
), #102
Deflate.EncodeTryDeflate
-> Compression.EncodeTryCompress
#105 #80 :pray: @nordfjord
TypeShape
reference to v 10
, triggering min FSharp.Core
target moving to 4.5.4
FSharpFunc
usage with Func
#92 #105
BREAKING: JsonPickler/JsonIsomorphism/UnionConverter
: Reduced greediness of Type
matching (only honors tags placed on the type being serialized, not parents) #113
Compression
: Switched encoding to use Brotli Compression (Deflate compressed content can still be inflated, but will no longer be generated) #105
Option/Tuple
: Replace with ValueOption
/ValueTuple
#82
Codec.Create
: Made timestamp mandatory in low level up
/ down
signature #83
Codec 'Context
: replace 'Context option
with Context
#82
IEventCodec.TryDecode
: Rename to Decode
(to align with the primary assumption of a Try
prefix per BCL conventions: It won't throw, no matter what!) #107 :pray: @nordfjord
NewtonsoftJson
: Rename Settings
to Options
#60 #76
NewtonsoftJson
: Upped minimum Newtonsoft.Json
version to 13.0.3
per GitHub advisory database #109
NewtonsoftJson.Codec
: Switched Event body type from byte[]
to ReadOnlyMemory<byte>
#75
NewtonsoftJson.Options
: Change all settings (inc CreateDefault
) to set DateParseHandling = DateParseHandling.None
in order to work around the hare-brained default #110
NewtonsoftJson.TypeSafeEnum
: Sync with SystemTextJson.TypeSafeEnum
#91
StreamName
: breaking changes to reflect introduction of strongly typed StreamId
#100
StreamName.trySplitCategoryAndId
: renames: trySplitCategoryAndStreamId
-> Internal.tryParse
; splitCategoryAndStreamId
-> split
; CategoryAndId
-> Split
; Categorized|NotCategorized
-> Internal
.*; category
->Category.ofStreamName
, IdElements
-> StreamId.Parse
#100
SystemTextJson.Codec
: Switched Event body type from JsonElement
to ReadOnlyMemory<byte>
#75
SystemTextJson.Options
: Move custom converters after specified options #111
SystemTextJson.UnionOrTypeSafeEnumConverterFactory
: Allow specific converters to override global policy #101
ToByteArrayCodec
: now adapts a ReadOnlyMemory<byte>
encoder (was from JsonElement
) (to byte[]
bodies); Moved from FsCodec.SystemTextJson
to FsCodec.Box
#75
TypeSafeEnum
: Merged two impls from SystemTextJson
and NewtonsoftJson
#102
Core.Codec
: Changed default timestamp to DateTime.UtcNow
as per docs (was: DateTime.Now
) #104
(NewtonsoftJson|SystemTextJson).TypeSafeEnum
: Merged/moved to FsCodec.TypeSafeEnum
#102
NewtonsoftJson
: Upped RecyclableMemoryStream
to >= 3.0.0
to handle breaking change in GetStream
return type #118
Full Changelog: https://github.com/jet/FsCodec/compare/2.3.2...3.0.0
Fast-follow release with breaking changes vs 2.3.1
, which (along with 2.3.0
) is unlisted
SystemTextJson
: Add Options.Default
to match JsonSerializerSettings.Default
#73SystemTextJson
: Replace autoUnion=true
with individually controllable autoTypeSafeEnumToJsonString
and autoUnionToJsonObject
settings re #71 #73See CHANGELOG
SystemTextJson
: Prevent UnionConverter
being applied to option
and list
types when using UnionOrTypeSafeEnumConverterFactory
/SystemTextJson.Options(autoUnion = true)
#72See CHANGELOG
2.3.1
, which has a critical fix for autoUnion
mode's handling of option
and list
types.SystemTextJson.UnionOrTypeSafeEnumConverterFactory
: Global converter that automatically applies a TypeSafeEnumConverter
to all Discriminated Unions that support it, and UnionConverter
to all others #69
SystemTextJson.Options(autoUnion = true)
: Automated wireup of UnionOrTypeSafeEnumConverterFactory
#69
SystemTextJson.UnionConverter
: Port of NewtonsoftJson
equivalent started in #43 #59 :pray: @NickDarvey
Serdes
: Changed Serdes
to be stateful, requiring a specific set of Options
/Settings
that are always applied consistently #70
Serdes.DefaultSettings
: Updated README.md ASP.NET integration advice to reflect minor knock-on effect #70
SystemTextJson
: Target System.Text.Json
v 6.0.1
, TypeShape
v 9.0.0
#68
See CHANGELOG
See CHANGELOG
AssemblyVersion
stamping 🙏 @mousakaNewtonsoftJson.Serdes.DefaultSettings
: Exposes default settings (for use with ASP.NET Core .AddNewtonsoftJson) #63SystemTextJson.Serdes.DefaultOptions
: Exposes default options (for use with ASP.NET Core .AddJsonOptions) #63See CHANGELOG
catchAllCase
from UnionConverter
arguments #51UnionConverter
s #52See CHANGELOG
Adds a full implementation of the FsCodec.Newtonsoft
feature-set based on System.Text.Json
NOTE 1: depends on preview edition of System.Text.Json
v 5-preview.3
NOTE 2: UnionEncoder
has not yet been completed https://github.com/jet/FsCodec/pull/43
See CHANGELOG
🙏 @ylibrach @nickdarvey for making it happen
See CHANGELOG
See CHANGELOG