feat: support more path parameter types in generated request building#2193
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2193 +/- ##
==========================================
+ Coverage 97.16% 97.17% +0.01%
==========================================
Files 129 129
Lines 6560 6556 -4
Branches 1216 1219 +3
==========================================
- Hits 6374 6371 -3
Misses 69 69
+ Partials 117 116 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Route parameters typed as enum, Guid, DateTimeOffset, DateOnly, TimeOnly, TimeSpan, sbyte, Int128/UInt128, Half (and any IFormattable type) now use the reflection-free generated request path, so they work under AddRefitGeneratedClient and NativeAOT instead of falling back to reflection. - Fixes Guid, DateTimeOffset and enum route parameters that were silently falling back to reflection.
c8ba254 to
ff205c0
Compare
|
ChrisPulman
approved these changes
Jul 2, 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?
Feature (with a couple of fixes).
What is the new behavior?
More route parameter types are built by the source generator instead of reflection, so they work when the client is resolved through
AddRefitGeneratedClient(generated-only) and under NativeAOT.Route parameters of these types now use the generated path:
GuidDateTime,DateTimeOffset,DateOnly,TimeOnly,TimeSpansbyteand the remaining integer widthsInt128,UInt128,HalfIFormattabletypeWhat is the current behavior?
These types fell back to the reflection request builder, which throws under
AddRefitGeneratedClient/NativeAOT.Guid,DateTimeOffsetand enum route parameters were falling back even outside AOT.What might this PR break?
None. URLs are formatted through the same
IUrlParameterFormatteras before, so generated output matches the reflection path.Checklist
mainbranchAdditional information
None.