Skip to content

Commit

Permalink
Merge pull request #130 from Zechiax/net8-upgrade
Browse files Browse the repository at this point in the history
.NET 8 upgrade, fix unit tests
  • Loading branch information
Zechiax authored Sep 9, 2024
2 parents 826da41 + 4ef8479 commit 447ceb6
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [ '6.0.x', '8.0.x' ]
dotnet: [ '8.0.x' ]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'

# Publish
- name: publish on version change
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Dotnet Setup
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'
dotnet-version: '8.x'
- run: dotnet tool update -g docfx
- run: dotnet build
- run: docfx docfx.json
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ C# Wrapper for the [Modrinth API](https://docs.modrinth.com/)
- Retry count is configurable
- No dependencies
- Fully documented
- Support for .NET 6.0 and newer
- Support for .NET 8.0 and newer

## Usage

Expand Down
8 changes: 4 additions & 4 deletions src/Modrinth.Net/Http/Requester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public class Requester : IRequester
Converters =
{
new ColorConverter(),
new JsonStringEnumConverter()
}
new JsonStringEnumConverter(namingPolicy: JsonNamingPolicy.SnakeCaseLower)
},
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
};

/// <summary>
Expand Down Expand Up @@ -83,8 +84,7 @@ public async Task<T> GetJsonAsync<T>(HttpRequestMessage request, CancellationTok
}
catch (JsonException e)
{
throw new ModrinthApiException($"Response could not be deserialize for Path {e.Path} | URL {request.RequestUri} | Response {response.StatusCode}",
response, innerException: e);
throw new ModrinthApiException($"Response could not be deserialize for Path {e.Path} | URL {request.RequestUri} | Response {response.StatusCode} | Data {await response.Content.ReadAsStringAsync(cancellationToken)}", response, innerException: e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Modrinth.Net/Models/Enums/NotificationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public enum NotificationType
/// <summary>
/// Project status update
/// </summary>
[JsonPropertyName("status_update")] StatusChange,
[JsonPropertyName("status_change")] StatusChange,

/// <summary>
/// Moderator message
Expand Down
3 changes: 2 additions & 1 deletion src/Modrinth.Net/Modrinth.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageVersion>3.4.5</PackageVersion>
<Version>$(PackageVersion)</Version>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Modrinth</RootNamespace>
<RepositoryType>git</RepositoryType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>12</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
4 changes: 3 additions & 1 deletion test/Modrinth.Net.Test/Modrinth.Net.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<LangVersion>12</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions test/Modrinth.Net.Test/ModrinthApiTests/EndpointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public class EndpointTests

protected static readonly string[] ValidSha512Hashes =
{
"bace1768e893e60574dcb1155e057a2fd0da3f3400c862a93c37dfe4d7908de1739b3b72190353f1a2a981ec18e1175d1dcf2109f0fb64ffdc73c45629a4cf55",
"3651e6cdb1dbb46580f27386caa01c88d28e51a5feec57cc435be73be25d718da9a719798e2b887e0fde14b6eaa970f30ee7220ff1f81489acd6174840c34d06"
"11732c4e36c3909360a24aa42a44da89048706cf10aaafa0404d7153cbc7395ff68a130f7b497828d6932740e004416b692650c3fbcc1f32babd7cb6eb9791d8",
"bffb4f0b5347ddcf85ee5d12a6a771098b7bb61a3354ce4afa6bcd4ab88e438d2b05380481995eb58ec1a0404fdddd9bd27706f2782e828628fc9dd12208e501"
};

protected static readonly string[] ValidSha1Hashes =
{"8b0a4139d9e82300b7aac82f2402ec3497991c52", "429eb439f0835e31fbbfd00234ef2daa8ecc8a87"};
{"43035a1c6f506285a9910bc8038d1b1b925f8dd1", "2f73c4a26c553bf0f0d2f921dd5a09ed90c515d8"};

private static readonly IConfigurationRoot Configuration =
new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
Expand Down

0 comments on commit 447ceb6

Please sign in to comment.