NavidK0 / SimpleGraphQL-For-Unity

A simple graphQL client that allows one to use .graphql files (or code) for queries, mutations, and subscriptions with Unity.
MIT License
34 stars 18 forks source link

fix: Stripping issues after switching to Unity's Newtonsoft.Json #20

Closed johanhelsing closed 3 years ago

johanhelsing commented 3 years ago

jilleJr/Newtonsoft.Json-for-Unity added these automatically, but the Unity package manager version doesn't.

They're not always needed, but just makes the library a lot easier to use if you use naming strategy attributes on the deserializable objects, i.e.:

[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
private class InsertResponse
{
    public int? AffectedRows { get; set; }
}

// ...

var result = await apiClient.Send(() => new { result = new InsertResponse() }, request);

Now works correctly.

johanhelsing commented 3 years ago

il2cpp stripping is a source of errors that just keeps giving.

It's also difficult add tests for, since it doesn't fail in the editor.

NavidK0 commented 3 years ago

Yeah, AOT and dynamic types have always been a challenge.