sdk-generator icon indicating copy to clipboard operation
sdk-generator copied to clipboard

feat: migrate .NET templates to System.Text.Json + add .NET 9.0 tests

Open Fellmonkey opened this issue 5 months ago • 5 comments

What does this PR do?

This pull request introduces two major improvements to the .NET SDK generator:

  1. Refactors from Newtonsoft.Json to System.Text.Json for serialization/deserialization - A comprehensive migration that modernizes the .NET SDK by replacing the legacy Newtonsoft.Json library with Microsoft's System.Text.Json library. This includes:

    • Updated package dependencies in Package.csproj.twig
    • Migrated all serialization/deserialization logic in Client.cs.twig, Query.cs.twig, and Extensions.cs.twig
    • Updated model attributes from [JsonProperty] to [JsonPropertyName] in Model.cs.twig
    • Created new ObjectToInferredTypesConverter.cs.twig for proper object type handling
    • Replaced JsonConverter with JsonConverter<object> in ValueClassConverter.cs.twig
    • Updated error handling to use JsonDocument instead of JObject
  2. Adds initial test support for .NET 9.0 SDK - Extends platform compatibility by adding test infrastructure for the latest .NET version:

    • Created DotNet90Test.php test class for .NET 9.0 SDK validation
    • Added Tests90.csproj project file targeting .NET 9.0 framework

Test Plan

Regenerate .NET SDKs using the updated templates and verify that existing client code continues to work without changes

Related PRs and Issues

(https://github.com/appwrite/sdk-for-dotnet/issues/48)

Have you read the Contributing Guidelines on issues?

Yes

Fellmonkey avatar Jun 02 '25 11:06 Fellmonkey