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.66k stars 744 forks source link

Add possibility to ignore property when building query #1889

Open Exellion opened 1 month ago

Exellion commented 1 month ago

The problem described in bug

I believe it will be useful if we can omit some properties when using Query attribute. For example, I have query model:

public class QueryParams
{
     [AliasAs("data")]
     public string Data { get; set; }

     // Some property for internal use only. Should be omitted in any query
     public string SomeForInternalUse { get; set; }
}

and some query:

[Post("/api/v1/someEndpoint")]
Task MakeRequestAsync([Query] QueryParams parameters)

I need to ignore property SomeForInternalUse

My proposals:

  1. Add [QueryIgnore] attribute
  2. Alternatively, use [AliasAs(null)] (it works previously and was unknowingly fixed in 1b45219)