Skip to content

17.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 30 Nov 14:56
ba1fb23

✨ Summary

No reflection in core Refit

Refit.Reflection now handles values that are only known at run time, such as object, interface, recursive and derived types. If nothing else loads that package, register it once at startup:

using Refit;

ReflectionSupport.EnsureRegistered();

public interface IEventsApi
{
    [Post("/events")]
    Task Send([Body(BodySerializationMethod.UrlEncoded)] object payload);
}

More generated at compile time

[EnumMember] names and nested, collection and dictionary form bodies are now generated, and form bodies of these shapes are 1.5 to 2.5 times faster:

public enum Status
{
    [EnumMember(Value = "in-progress")]
    InProgress,
}

public sealed class OrderForm
{
    public Status Status { get; set; }
    public Address Shipping { get; set; } = new();
    public Dictionary<string, int> Lines { get; set; } = [];
}

public interface IOrdersApi
{
    [Post("/orders")]
    Task Create([Body(BodySerializationMethod.UrlEncoded)] OrderForm form);
}

Typed JSON replies in Refit.Testing

Stub replies can use source-generated JSON metadata, so tests work with trimming and Native AOT:

stub.Add(Route.Get("/people/1"), Reply.With(person, TestingJsonContext.Default.TestingPerson));
stub.Add(Route.Post("/people"), Reply.With(person, TestingJsonContext.Default.TestingPerson, HttpStatusCode.Created));

Trimming and build fixes

  • Generated clients use modern trimming annotations instead of Preserve attributes.
  • Projects that see several copies of DynamicDependencyAttribute no longer get CS0436.

Upgrade notes

  • A form value whose run-time type differs from its declared type needs Refit.Reflection.
  • Enums typed only at run time keep their [EnumMember] names only when Refit.Reflection is registered.
  • Production assemblies no longer grant each other InternalsVisibleTo.

🗞️ What's Changed

♻️ Refactoring

🐛 Fixes

🧹 General Changes

📝 Documentation

📦 Dependencies

  • 21e868a chore(deps): update dependency reactiveui.primitives to 10.1.0 (#2383) renovate[bot]
  • ed52483 chore(deps): update dependency tunit to 1.87.12 (#2366) renovate[bot]

🔗 Full Changelog: v17.0.0...v17.1.0

🙌 Contributions

💖 Thanks to all the contributors: @glennawatson

🤖 Automated services that contributed: reactiveui-deploy-app[bot], renovate[bot]