Summary
Refit 14 completes the shift to reflection-free, source-generated request building: interfaces whose methods all generate inline no longer touch the reflection request builder, so they are trim- and Native AOT-clean. The reflection request builder is now an opt-in package, and a few hot-path async members return ValueTask instead of Task. These are breaking changes - read the Breaking Changes below and the full v14 migration notes before upgrading.
Alongside that, this release adds a batch of request-shaping features - the new [Url], [PathPrefix], [Timeout], and [FormObject] attributes, optional {name?} URL segments, Server-Sent Events streaming, a per-type URL parameter formatter registry, optional/scoped authorization, building a request without sending it, and exposing call arguments to delegating handlers - plus bug fixes, a performance pass, and new analyzer diagnostics for invalid Refit interfaces.
๐๏ธ What's Changed
๐ฅ Breaking Changes
- e511df2 feat!: reflection-free source-generated request building (#2210) @glennawatson @TimothyMakkison
โจ Features
- 485c632 feat: opt-in [FormObject] flattens a model into multipart form fields (#2245) @glennawatson
- 88e1c24 feat: add generic tests to
ReflectionTests(#2195) @TimothyMakkison - 463f5cf feat: add [Timeout] attribute for per-method request timeouts (#2238) @glennawatson
- 7c33871 feat: add opt-in RefitSettings.ValidateHeaders (#2225) @glennawatson
- 294e63a feat: add success guards to the non-generic IApiResponse (#2242) @glennawatson
- d9b3d5f feat: support Server-Sent Events as a streaming content format (#2232) @glennawatson
- 759a3c0 feat: support returning the built HttpRequestMessage without sending (#2235) @glennawatson
- f754684 feat: add interface-level [PathPrefix] attribute for a shared route prefix (#2240) @glennawatson
- 99c055b feat: support optional url segments with {name?} syntax (#2237) @glennawatson
- 1e35cc9 feat: add [Url] attribute for absolute request URLs (#2236) @glennawatson
- b583a34 feat: add null handling for round trip parameter and add verifying test (#2201) @TimothyMakkison
- 7ac3e1a feat: fix failiure when multiple generic overloads (#2199) @TimothyMakkison
- 852cb2c feat: move version configuration into
AddConfiguredRequestOptions(#2214) @glennawatson @TimothyMakkison - aa1c19b feat: publish method name and route template in request options (#2239) @glennawatson
- 37efb4e feat: add per-type URL parameter formatter registry (#2226) @glennawatson
- a2b1581 feat: add analyzer diagnostics for invalid Refit interfaces (#2220) @glennawatson
- 4068d97 feature: Create a TransportExceptionFactory to let the user decide the exception to be thrown (#2205) @glennawatson @jgarciadelanoceda
- ed63528 feat: optional auth header and scoped authorization token provider (#2221) @glennawatson
- 7bf7b41 feat: inline constrained-generic path-bound objects in the source generator (#2222) @glennawatson
- 14895a4 feat: expose call argument values to DelegatingHandlers (#2223) @glennawatson
๐ Fixes
- 809de10 fix: do not dispose caller-supplied request streams (#2234) @glennawatson
- 02a037b fix: flatten nested objects in url-encoded request bodies (#2224) @glennawatson
โก Performance
- b575c9d perf:
AllAttributesCachereplaceLazywith laziliy initialised code (#2211) @TimothyMakkison
๐งน General Changes
- 44f81de ci: gate native AOT smoke test via shared reusable workflow (#2244) @glennawatson
- 393b245 ci: add alpha/beta/rc pre-release channel to release workflow @glennawatson
- 3d0546d build: add PerformanceSharp.Analyzers and upgrade StyleSharp.Analyzers to 3.17.7 (#2206) @glennawatson
- ddc42c9 build: upgrade StyleSharp/PerformanceSharp analyzers to 3.26.0 (#2227) @glennawatson
โ Tests
- e5da8b8 test: reach 100% product code coverage (#2243) @glennawatson
- e67c5c4 test: cover TransportExceptionFactory cancellation and timeout behavior (#2203) @arpitjain099 @glennawatson
- 865d0f2 test(refit.testing): cover retry and timeout scenarios (#2208) @glennawatson
๐ Documentation
- 69eb3ee docs: document IQueryConverter and httpClientName client-name override (#2233) @glennawatson
- 544db0b docs: make v12 Error.Content migration discoverable and add interface composition example (#2217) @glennawatson
๐ฆ Dependencies
๐ Full Changelog: v13.1.0...v14.0.0-beta.1
๐ Contributions
๐ฑ New contributors since the last release: @arpitjain099, @jgarciadelanoceda
๐ Thanks to all the contributors: @arpitjain099, @glennawatson, @jgarciadelanoceda, @TimothyMakkison
๐ค Automated services that contributed: @renovate[bot]