reactiveui / refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.
https://reactiveui.github.io/refit/
MIT License
8.45k stars 746 forks source link

[BUG] Array deserialization with AliasAs doesn't work, but works with JsonProperty #1218

Open opcodewriter opened 3 years ago

opcodewriter commented 3 years ago

Description

Refit v6.0.94 .NET Standard 2.0 (in a UWP app)

Using AliasAs doesn't work for array (the property value is null):

        [**AliasAs**("someIds")]
        public int[] LocationIds { get; set; }

but works with JsonProperty:

        [**JsonProperty**("someIds")]
        public int[] LocationIds { get; set; }

Hope it helps someone. I won't disclose the no. of hours it took me to figure it out because it's embarrassing 🤭 😳.

ugurozturk commented 1 month ago

AliasAs also doesn't work on normal response properties. But System.Text.Json.Serialization's JsonPropertyName works.