From e83dafbffb64be1c1055a525b47de2552dfff751 Mon Sep 17 00:00:00 2001 From: Dmytro Khmara Date: Mon, 7 Jul 2025 22:39:27 +0100 Subject: [PATCH] Add support for System.Text.Json v9. --- .github/workflows/build.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- Dockerfile | 8 ++++---- LICENSE.txt | 2 +- README.md | 4 ++-- .../JsonSerializerOptionsExtensions.cs | 2 +- .../StrEnum.System.Text.Json.csproj | 2 +- ...Enum.System.Text.Json.IntegrationTests.csproj | 16 ++++++++-------- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2bdc68..edc48d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,10 +12,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Set up .NET 7 + - name: Set up .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '7' + dotnet-version: '9' - name: Build run: docker build --target build . - name: Test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 21deed2..ffd488d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,10 +8,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Set up .NET 7 + - name: Set up .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '7' + dotnet-version: '9' - name: Set VERSION variable from tag run: echo "VERSION=${GITHUB_REF/refs\/tags\/}" >> $GITHUB_ENV - name: Build diff --git a/Dockerfile b/Dockerfile index 25f72c9..fc10951 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /source # copy csproj and restore as distinct layers @@ -10,12 +10,12 @@ RUN dotnet restore # copy everything else and build app COPY ./ ./ WORKDIR /source -RUN dotnet build -c release -o /out/package --no-restore +RUN dotnet build -c release --no-restore -FROM build as test +FROM build AS test RUN dotnet test -FROM build as pack-and-push +FROM build AS pack-and-push WORKDIR /source ARG PackageVersion diff --git a/LICENSE.txt b/LICENSE.txt index 389d402..0cd0e9f 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Dmitry Khmara +Copyright (c) 2025 Dmytro Khmara Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 74d9901..13ae04f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Allows for [StrEnum](https://github.com/StrEnum/StrEnum/) string enum JSON serialization and deserialization with System.Text.Json. -The package targets .NET Standard 2.0 and can be used with System.Text.Json 4.6.0-7.\*. +The package targets .NET Standard 2.0 and can be used with System.Text.Json 4.6.0-9.\*. ## Installation @@ -66,6 +66,6 @@ new { Name = "Cape Town Cycle Tour", Sport = Sport.RoadCycling }; ## License -Copyright © 2022 [Dmitry Khmara](https://dmitrykhmara.com). +Copyright © 2025 [Dmytro Khmara](https://dmytrokhmara.com). StrEnum is licensed under the [MIT license](LICENSE.txt). \ No newline at end of file diff --git a/src/StrEnum.System.Text.Json/JsonSerializerOptionsExtensions.cs b/src/StrEnum.System.Text.Json/JsonSerializerOptionsExtensions.cs index b35b1e5..271e3a0 100644 --- a/src/StrEnum.System.Text.Json/JsonSerializerOptionsExtensions.cs +++ b/src/StrEnum.System.Text.Json/JsonSerializerOptionsExtensions.cs @@ -9,7 +9,7 @@ public static class JsonSerializerOptionsExtensions /// Configure System.Text.Json to serialize and deserialize string enums. /// /// - /// Specifies whether to thrown an exception or use a null value for members that cannot be parsed. + /// Specifies whether to throw an exception or use a null value for members that cannot be parsed. /// public static JsonSerializerOptions UseStringEnums(this JsonSerializerOptions options, NoMemberFoundBehavior noMemberFoundBehavior = NoMemberFoundBehavior.ThrowException) { diff --git a/src/StrEnum.System.Text.Json/StrEnum.System.Text.Json.csproj b/src/StrEnum.System.Text.Json/StrEnum.System.Text.Json.csproj index 71495da..9007f73 100644 --- a/src/StrEnum.System.Text.Json/StrEnum.System.Text.Json.csproj +++ b/src/StrEnum.System.Text.Json/StrEnum.System.Text.Json.csproj @@ -18,7 +18,7 @@ - + diff --git a/test/StrEnum.System.Text.Json.IntegrationTests/StrEnum.System.Text.Json.IntegrationTests.csproj b/test/StrEnum.System.Text.Json.IntegrationTests/StrEnum.System.Text.Json.IntegrationTests.csproj index 9aa43e5..f7f3523 100644 --- a/test/StrEnum.System.Text.Json.IntegrationTests/StrEnum.System.Text.Json.IntegrationTests.csproj +++ b/test/StrEnum.System.Text.Json.IntegrationTests/StrEnum.System.Text.Json.IntegrationTests.csproj @@ -1,23 +1,23 @@ - net7.0 + net9.0 enable false - - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all