Repository navigation
fix!: read problem details without a serializer, move reflection to Refit.Reflection, drop deprecated .NET 8/9 - #2374
Merged
Merged
Conversation
- 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>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2374 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 242 250 +8
Lines 13018 12949 -69
Branches 2416 2401 -15
=========================================
- Hits 13018 12949 -69 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- 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>
- Remove RequiresUnreferencedCode and RequiresDynamicCode from IRequestBuilder and GeneratedOnlyRequestBuilder Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
- 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>
- 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>
- 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>
- 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>
…tion - RestMethodInfo, RestMethodParameterInfo and RestMethodParameterProperty are only produced by the reflection pipeline Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
…eflection - 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>
- 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>
…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>
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
…rovider 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>
…tration - 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>
- 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>
- 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>
- Remove checks already implied by IsNullOrWhiteSpace and the earlier delay validation Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
Co-authored-by: Atakan Ük <61142938+AtakanUk@users.noreply.github.com>
- 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>
…ches - 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>
- 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>
- 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>
|
ChrisPulman
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What kind of change does this PR introduce?
Bug fix (#2368), and removal of everything in the non-reflection packages that blocks the System.Text.Json fast path or uses reflection.
What is the new behavior?
ValidationApiExceptionreads problem details with Refit's ownJsonElementreader. No metadata, reflection or configured serializer needed ([Bug]: problem+json responses silently become a plain ApiException with source-generated JSON metadata or in a trimmed app #2368).NumberHandling.CamelCaseStringEnumConverteris gone andProblemDetails.Extensionshas no[JsonExtensionData]. For enum strings, setUseStringEnumConverter = trueon your source-generated context.Refit.Reflectionand the newRefit.HttpClientFactory.Reflection:RestService.For,RequestBuilder,AddRefitClient,AddKeyedRefitClient,ObjectToInferredTypesConverter, the method metadata types, and form and enum reflection.IUrlParameterFormattertakes a Refit-ownedIParameterAttributeProviderinstead ofICustomAttributeProvider.Refit.Newtonsoft.JsonandRefit.Xmlare marked not trimmable and not AOT compatible.Breaking changes
objectreads asJsonElement).ValidationApiExceptionignores the configured serializer, andProblemDetails.Extensionslost[JsonExtensionData].Refit.Reflection(orRefit.HttpClientFactory.Reflection).ReflectionSupport.EnsureRegistered().IHttpContentSerializer.GetFieldNameForPropertyis removed (useIReflectionFieldNameProvider).IUrlParameterFormatterimplementations change their second parameter toIParameterAttributeProvider.FormField<T>has a new constructor.Closes #2368