Skip to content

Commit b88959f

Browse files
authored
Target System.Text.Json 5.0.0 final (#66)
1 parent 0646577 commit b88959f

13 files changed

Lines changed: 47 additions & 58 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ The `Unreleased` section name is replaced by the expected version of next releas
1010

1111
### Added
1212
### Changed
13+
14+
- `FsCodec.SystemTextJson` - updated to target released `System.Text.Json` v `5.0.0` binaries [#66](https://github.com/jet/FsCodec/pull/66)
15+
1316
### Removed
1417
### Fixed
1518

Directory.Build.props

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
<TestTargetFrameworks>netcoreapp3.1;net461</TestTargetFrameworks>
1212
<!-- avoid fighting with CI images about getting mono to run on MacOSX-->
13-
<TestTargetFrameworks Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">netcoreapp3.1</TestTargetFrameworks>
14-
13+
<TestTargetFrameworks Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">net5.0</TestTargetFrameworks>
1514
<ThisDirAbsolute>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)"))</ThisDirAbsolute>
1615

1716
<!-- SourceLink related properties https://github.com/dotnet/SourceLink#using-sourcelink -->
@@ -32,4 +31,4 @@
3231
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3332
</Content>
3433
</ItemGroup>
35-
</Project>
34+
</Project>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Typically used in [applications](https://github.com/jet/dotnet-templates) levera
77

88
## Components
99

10-
The components within this repository are delivered as multi-targeted Nuget packages supporting `net461` (F# 3.1+) and `netstandard2.0` (F# 4.5+) profiles.
10+
The components within this repository are delivered as multi-targeted Nuget packages supporting `net461` (F# 3.1+) and `netstandard2.0`/`1` (F# 4.5+) profiles.
1111

1212
- [![Codec NuGet](https://img.shields.io/nuget/v/FsCodec.svg)](https://www.nuget.org/packages/FsCodec/) `FsCodec` Defines interfaces with trivial implementation helpers.
1313
- No dependencies.

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "3.1.101",
3+
"version": "5.0.200",
44
"rollForward": "latestFeature"
55
}
66
}

src/FsCodec.NewtonsoftJson/FsCodec.NewtonsoftJson.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@
3636
<ProjectReference Include="../FsCodec/FsCodec.fsproj" />
3737
</ItemGroup>
3838

39-
</Project>
39+
</Project>

src/FsCodec.NewtonsoftJson/Settings.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Settings private () =
3838
MissingMemberHandling = (if errorOnMissing then MissingMemberHandling.Error else MissingMemberHandling.Ignore),
3939
NullValueHandling = (if ignoreNulls then NullValueHandling.Ignore else NullValueHandling.Include))
4040

41-
/// Optionated helper that creates serializer settings that provide good defaults for F#
41+
/// Opinionated helper that creates serializer settings that provide good defaults for F#
4242
/// - no camel case conversion - assumption is you'll use records with camelCased names
4343
/// - Always prepends an OptionConverter() to any converters supplied
4444
/// - everything else is as per CreateDefault:- i.e. emit nulls instead of omitting fields etc

src/FsCodec.SystemTextJson/FsCodec.SystemTextJson.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626

2727
<PackageReference Include="FSharp.Core" Version="4.3.4" />
2828

29-
<PackageReference Include="System.Text.Json" Version="5.0.0-preview.3.20214.6" />
29+
<PackageReference Include="System.Text.Json" Version="5.0.1" />
3030
<PackageReference Include="TypeShape" Version="8.0.0" />
3131
</ItemGroup>
3232

3333
<ItemGroup>
3434
<ProjectReference Include="../FsCodec/FsCodec.fsproj" />
3535
</ItemGroup>
3636

37-
</Project>
37+
</Project>

tests/FsCodec.NewtonsoftJson.Tests/Examples.fsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
// Compile the fsproj by either a) right-clicking or b) typing
22
// dotnet build tests/FsCodec.NewtonsoftJson.Tests before attempting to send this to FSI with Alt-Enter
33

4-
#if VISUALSTUDIO
5-
#r "netstandard"
6-
#endif
7-
#I "bin/Debug/netcoreapp3.1"
8-
#r "Newtonsoft.Json.dll"
9-
#r "Serilog.dll"
10-
#r "Serilog.Sinks.Console.dll"
11-
#r "TypeShape.dll"
12-
#r "FsCodec.dll"
13-
#r "FsCodec.NewtonsoftJson.dll"
14-
#r "FSharp.UMX.dll"
4+
#r "nuget: FsCodec.NewtonsoftJson"
5+
#r "nuget: Serilog.Sinks.Console"
156

167
open FsCodec.NewtonsoftJson
178
open Newtonsoft.Json
@@ -230,15 +221,13 @@ Unhandled Event: Category Misc, Id x, Index 0, Event: "Dummy"
230221
Where relevant, a decoding process may want to extract such context alongside mapping the base information.
231222
*)
232223

233-
module EventsWithMeta =
224+
module Reactions =
234225

235-
type EventWithMeta = int64 * DateTimeOffset * Events.Event
226+
type Event = int64 * DateTimeOffset * Events.Event
236227

237228
let codec =
238-
let up (raw : FsCodec.ITimelineEvent<byte[]>, contract : Events.Event) : EventWithMeta =
239-
raw.Index, raw.Timestamp, contract
240-
let down ((_index, timestamp, event) : EventWithMeta) =
241-
event, None, Some timestamp
229+
let up (raw : FsCodec.ITimelineEvent<byte[]>, contract : Events.Event) : Event = raw.Index, raw.Timestamp, contract
230+
let down ((_index, timestamp, event) : Event) = event, None, Some timestamp
242231
FsCodec.NewtonsoftJson.Codec.Create(up, down)
243232

244233
(* Helpers for parsing individual events *)
@@ -260,7 +249,7 @@ module EventsWithMeta =
260249
let runWithContext () =
261250
for stream, event in events do
262251
match stream, event with
263-
| EventsWithMeta.Match (clientId, (index, ts, e)) ->
252+
| Reactions.Match (clientId, (index, ts, e)) ->
264253
printfn "Client %s index %d time %O event %A" (ClientId.toString clientId) index (ts.ToString "u") e
265254
| FsCodec.StreamName.CategoryAndId (cat, id), e ->
266255
printfn "Unhandled Event: Category %s, Id %s, Index %d, Event: %A " cat id e.Index e.EventType

tests/FsCodec.NewtonsoftJson.Tests/FsCodec.NewtonsoftJson.Tests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
2121
<PackageReference Include="Serilog" Version="2.9.0" />
2222
<PackageReference Include="Serilog.Sinks.Console" Version="3.0.0" />
23-
<PackageReference Include="Unquote" Version="5.0.0" />
23+
<PackageReference Include="Unquote" Version="6.1.0" />
2424
<PackageReference Include="xunit" Version="2.4.1" />
2525
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
2626
</ItemGroup>

tests/FsCodec.NewtonsoftJson.Tests/UnionConverterTests.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ let ``deserializes properly`` () =
113113

114114
test <@ CaseE ("hi", 0) = deserialize """{"case":"CaseE","Item1":"hi","Item2":0}""" @>
115115
// NB this only passes by virtue of MissingMemberHandling=Ignore and NullValueHandling=Ignore in default settings
116-
test <@ CaseE (null, 0) = deserialize """{"case":"CaseE","Item3":"hi","Item4":0}""" @>
117-
116+
test <@ CaseE (null, 0) = deserialize """{"case":"CaseE","Item1":null,"Item2":0,"Item3":"hi","Item4":"0"}""" @>
118117
test <@ CaseF ("hi", 0) = deserialize """{"case":"CaseF","a":"hi","b":0}""" @>
119118

120119
test <@ CaseG {Item = "hi"} = deserialize """{"case":"CaseG","Item":"hi"}""" @>

0 commit comments

Comments
 (0)