FsCodec Versions Save

F# Event-Union Contract Encoding with versioning tolerant converters supporting System.Text.Json and Newtonsoft.Json

3.0.0

2 months ago

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:

  • Exposes a 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 names
  • Migrates from byte[] Event Bodies to System.ReadOnlyMemory - this is the default body types for most Equinox V4 stores, and for Propulsion V3
  • Updates minimum Newtonsoft.Json dependency to silence security scanners
  • Pushes various pieces e.g. Union and TypeSafeEnum (which started life as independent implementations per concrete Codec) to the core module
  • Removes usage of F#-specific and/or otherwise deprecated types from the public interface (FSharpFunc->Func, System.Tuple->System.ValueTuple)

Added

  • Codec.Create: Exposed low level overload for infrastructure use
  • Core.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 StreamNames). (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

Changed

  • Rename Deflate.EncodeTryDeflate -> Compression.EncodeTryCompress #105 #80 :pray: @nordfjord
  • updated TypeShape reference to v 10, triggering min FSharp.Core target moving to 4.5.4
  • replace all 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

Removed

  • net461 support #60 #76
  • StreamName.CategoryAndIds: See new StreamId, StreamId.Elements #100

Fixed

New Contributors

Full Changelog: https://github.com/jet/FsCodec/compare/2.3.2...3.0.0

2.3.2

2 years ago

Fast-follow release with breaking changes vs 2.3.1, which (along with 2.3.0) is unlisted

Added

Changed

  • SystemTextJson: Replace autoUnion=true with individually controllable autoTypeSafeEnumToJsonString and autoUnionToJsonObject settings re #71 #73

See CHANGELOG

2.3.1

2 years ago

Fixed

  • SystemTextJson: Prevent UnionConverter being applied to option and list types when using UnionOrTypeSafeEnumConverterFactory/SystemTextJson.Options(autoUnion = true) #72

See CHANGELOG

2.3.0

2 years ago

NOTE: Unlisted in favor of 2.3.1, which has a critical fix for autoUnion mode's handling of option and list types.

Added

  • 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

Changed

  • 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

2.2.2

2 years ago

See CHANGELOG

Fixed/Changed

  • Updated to MinVer 2.5.0, .NET SDK 5.0.200 in order to fix internal AssemblyVersion stamping 🙏 @mousaka

2.2.0

3 years ago
  • Added: NewtonsoftJson.Serdes.DefaultSettings: Exposes default settings (for use with ASP.NET Core .AddNewtonsoftJson) #63
  • Added: SystemTextJson.Serdes.DefaultOptions: Exposes default options (for use with ASP.NET Core .AddJsonOptions) #63
  • Fixed: Clarify StreamName.parse exception message #58 🙏 @dharmaturtle
  • Fixed: Remove erroneous Converters from FsCodec.SystemTextJson.Converters.JsonOptionConverter namespacing

See CHANGELOG

2.1.1

4 years ago
  • Enable omission of catchAllCase from UnionConverter arguments #51
  • (Slightly simplistically) Handle nested UnionConverters #52

See CHANGELOG

2.1.0

4 years ago

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

2.0.1

4 years ago

See CHANGELOG

2.0.0

4 years ago

See CHANGELOG