refit
refit copied to clipboard
question: does Refit support C# 9 record?
C#9 records are finally the immutable type that we needed in C#. Since it's syntax is game changing, does refit supports serializing/deserializing such objects ?
I think they're already supported as, from my understanding, records are classes under the hood.
I use records as an input model and as a result model. It works fine :)
Does it work with [AliasAs] attribute? I had some issued with it when used like this:
public record AuthRequest([AliasAs("grant_type")] string GrantType,
[AliasAs("scope")] string Scope,
[AliasAs("client_id")] string ClientId,
[AliasAs("client_secret")] string ClientSecret);
In this case the [AliasAs] is not reflected and the content looks like this
GrantType=client_credentials&Scope=read%3Aall&ClientId=foobar&ClientSecret=foobar
but should look like
grant_type=client_credentials&scope=read%3Aall&client_id=foobar&client_secret=foobar
Hi! I have the same issue. [AliasAs] does not work with records and their primary c-tors
JsonProperty doesn't work with records also