Repository navigation
Commit 89779cd
fix!: read problem details without a serializer, move reflection to Refit.Reflection, drop deprecated .NET 8/9 (#2374)
* fix: read problem details without the configured serializer
- Read problem+json with Refit's own JsonElement reader, so it works with any resolver, when trimmed and under Native AOT
- Drop the default converters and number handling so the default options keep the System.Text.Json fast path
- Remove JsonExtensionData from ProblemDetails.Extensions and the unused ProblemDetailsJsonContext
- Move ObjectToInferredTypesConverter to Refit.Reflection and add AddReflectionConverters for opt-in enum names and inferred objects
Closes #2368
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: move reflection entry points into the reflection packages
- Move RestService.For and RequestBuilder to Refit.Reflection as extension members, keeping the call syntax
- Add Refit.HttpClientFactory.Reflection for AddRefitClient and AddKeyedRefitClient
- Make Refit.Testing use Refit.Reflection for CreateClient
- Drop net8.0 and net9.0 targets and their API baselines
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: drop reflection attributes from the request builder contracts
- Remove RequiresUnreferencedCode and RequiresDynamicCode from IRequestBuilder and GeneratedOnlyRequestBuilder
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* feat: generate serializer-specific form field names
- Add FormFieldNames and IContentSerializerNameStyle so generated form fields pick the right compile-time name
- Read Newtonsoft JsonProperty and XmlElement or XmlAttribute names in the generator
- Use the generated path for the Newtonsoft and Xml serializers, not just System.Text.Json
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: move reflection form flattening into Refit.Reflection
- Core flattens simple values, collections and dictionaries and calls a registered flattener only for run-time-typed complex values
- Move the property walk, its metadata cache and ReflectionPropertyHelpers to Refit.Reflection
- Add ReflectionSupport.EnsureRegistered, called by every reflection entry point
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: move serializer field-name lookup into Refit.Reflection
- Remove IHttpContentSerializer.GetFieldNameForProperty and the PropertyInfo hook from the System.Text.Json, Newtonsoft and Xml serializers
- Resolve names in Refit.Reflection from each serializer's name style, with IReflectionFieldNameProvider for custom serializers
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: move enum member lookup into Refit.Reflection
- EnumHelpers keeps the numeric helpers; the run-time EnumMember attribute lookup is registered by Refit.Reflection
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: move the reflection method metadata types into Refit.Reflection
- RestMethodInfo, RestMethodParameterInfo and RestMethodParameterProperty are only produced by the reflection pipeline
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: move the System.Text.Json reflection fallbacks into Refit.Reflection
- The serializer always reads type metadata; options with no resolver get the reflection resolver Refit.Reflection registers, or a message explaining how to supply a context
- Remove the per-method reflection fallbacks, the polymorphism attribute checks and the trim suppressions
- StubHttp, the reflection request builder and RestService.For register the support
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* test: cover the reflection support and drop the last converter read
- Remove the Converters read from WritesDeclaredTypeAsObject so no production code touches a fast-path-blocking option
- Add converter and name-lookup tests for the types moved into Refit.Reflection
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: mark the Newtonsoft and XML serializers as not trim or AOT compatible
- Remove the trim and AOT suppressions from the Newtonsoft and XML serializers, which wrap reflection-based libraries
- Cover the generator's named attribute argument parsing
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* test: cover the enum lookup without a registered resolver
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor!: replace ICustomAttributeProvider with IParameterAttributeProvider in the formatter contract
- Add Refit-owned IParameterAttributeProvider so IUrlParameterFormatter no longer exposes System.Reflection
- Generated and core code pass an empty provider instead of a Type
- Wrap reflection elements in CachedAttributeProvider in Refit.Reflection
- Refresh public API baselines, snapshots, tests, examples and benchmarks
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: remove the DynamicDependency attribute from generated registration
- Drop the emitted DynamicallyAccessedMemberTypes.All dependency and its polyfill
- Refresh snapshots and the test that asserted on it
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* docs: ban LINQ in production code
- Add the rule to CLAUDE.md
- Drop an unused System.Reflection using from the Newtonsoft serializer
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: keep DefaultJsonTypeInfoResolver out of core Refit
- Detect and copy modifiers of the reflection resolver through hooks registered by Refit.Reflection
- Replace the uncovered loop in FallbackExplanation with an index check
- Cover the unregistered hook paths
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* refactor: drop redundant null and range checks
- Remove checks already implied by IsNullOrWhiteSpace and the earlier delay validation
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* test: cover a null global Newtonsoft settings factory
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* test: fix repeated literal in the Newtonsoft settings test
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* test: cover body model equality and interpolated brace escaping
- Remove the dead AllowRelative key check, as it is the attribute's only member
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* test: cover more async disposal, route binding and query parsing branches
- Exclude two compiler-generated async finally edges and one unreachable BCL fallback
- Cover the retry ISO date with an empty value and the query string parser directly
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* test: reach full line and branch coverage
- Cover generator edge cases: split partial interfaces, a missing Refit reference, three-argument returns and relative URLs on observables
- Cover the analyzer location and path helpers, async disposal and route binding branches
- Split the return type and delimiter classification into small testable helpers
- Exclude only compiler-generated async finally edges and an unreachable BCL fallback
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
* fix: repair CI for .NET Framework, Native AOT and shared serializers
- Register generated clients on .NET Framework by declaring ModuleInitializerAttribute when the target lacks it
- Assign the default JSON resolver under a lock so a shared serializer is thread safe
- Keep reflection registration out of the StubHttp constructor so AOT apps stay clean
- Drop the stale Refit.Reflection trimmer root and pack Refit.Reflection for the package consumer
- Update the ProblemDetails sample now that the metadata no longer fails
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
---------
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>1 parent baf69ae commit 89779cd
305 files changed
Lines changed: 5945 additions & 7611 deletions
File tree
- .github/workflows
- src
- Polyfills
- Refit.Analyzers.Roslyn48
- Refit.HttpClientFactory.Reflection
- PublicAPI
- net10.0
- net11.0
- net462
- net470
- net471
- net472
- net481
- net48
- Refit.HttpClientFactory
- PublicAPI
- net10.0
- net11.0
- net462
- net470
- net471
- net472
- net481
- net48
- net8.0
- net9.0
- Refit.NativeAotSmoke
- Refit.NetFrameworkSmoke
- Refit.Newtonsoft.Json
- PublicAPI
- net10.0
- net11.0
- net462
- net470
- net471
- net472
- net481
- net48
- net8.0
- net9.0
- Refit.Reflection
- PublicAPI
- net10.0
- net11.0
- net462
- net470
- net471
- net472
- net481
- net48
- net8.0
- net9.0
- targets
- Refit.Testing
- PublicAPI
- net10.0
- net11.0
- net8.0
- net9.0
- Refit.Xml
- PublicAPI
- net10.0
- net11.0
- net462
- net470
- net471
- net472
- net481
- net48
- net8.0
- net9.0
- Refit
- PublicAPI
- net10.0
- net11.0
- net462
- net470
- net471
- net472
- net481
- net48
- net8.0
- net9.0
- benchmarks/Refit.Benchmarks
- examples
- Documentation
- Aot/NativeClient
- Bodies
- Clients/Reflection
- Content
- Errors
- JsonContexts
- Pages
- advanced-index
- advanced-method-metadata
- advanced-query-builder
- advanced-request-helpers
- aot
- clients-creation
- clients-dependency-injection
- clients-index
- clients-request-builders
- clients-resilience
- clients-settings
- clients-telemetry
- index
- requests-bodies
- requests-headers
- requests-index
- requests-multipart
- requests-queries
- requests-query-converters
- requests-query-formatters
- requests-request-context
- requests-routes
- results-adapters
- results-errors
- results-index
- results-paging
- results-responses
- results-return-types
- results-streaming
- serialization-content
- serialization-index
- serialization-json
- serialization-newtonsoft-json
- serialization-xml
- testing-faults
- testing-index
- testing-replies
- testing-response-stubs
- testing-routes
- testing-streaming
- testing-verification
- why-refit
- Queries
- RuntimeHelpers
- Serialization
- Other
- Meow.Common
- Meow
- SampleUsingLocalApi
- ConsoleApplication
- LibraryWithSDKandRefitService
- RestApiforTest
- tests
- Refit.Analyzers.Internals.Tests
- Refit.Analyzers.Tests
- Refit.GeneratorTests
- _snapshots
- Refit.Newtonsoft.Json.Tests
- Refit.Testing.Tests
- Refit.Tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
| 209 | + | |
211 | 210 | | |
212 | 211 | | |
213 | 212 | | |
| |||
239 | 238 | | |
240 | 239 | | |
241 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
242 | 266 | | |
243 | 267 | | |
244 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | | - | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
| 126 | + | |
120 | 127 | | |
121 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
122 | 136 | | |
123 | 137 | | |
124 | 138 | | |
| |||
155 | 169 | | |
156 | 170 | | |
157 | 171 | | |
| 172 | + | |
158 | 173 | | |
159 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
160 | 182 | | |
161 | 183 | | |
162 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
746 | 762 | | |
747 | 763 | | |
748 | 764 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
260 | 258 | | |
261 | 259 | | |
262 | 260 | | |
263 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
264 | 288 | | |
265 | 289 | | |
266 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
292 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
293 | 296 | | |
294 | | - | |
| 297 | + | |
295 | 298 | | |
296 | 299 | | |
297 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
112 | 116 | | |
113 | | - | |
114 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
115 | 135 | | |
116 | 136 | | |
117 | 137 | | |
| |||
0 commit comments