You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refit's [Query] always emits key=value. There's no way to emit a valueless query flag — a bare ?filter with no = — which some APIs use for presence-style switches.
Prior art: Retrofit @QueryName
Retrofit has @QueryName: the parameter value becomes the query parameter name with no value. A List/array produces multiple bare flags (?a&b&c). encoded=true disables encoding of the name.
Proposal
Add an equivalent — most naturally a small attribute (e.g. [QueryName]) or an option on [Query] — that renders the parameter's string value as a valueless query segment. Collections render as repeated bare names. Honour the existing query encoding/URI-format settings.
Considerations
Interaction with UrlResolutionMode and QueryUriFormatAttribute.
Null handling: omit on null (consistent with [Query]).
Must be implemented in both the reflection and source-generator paths.
Decide attribute-vs-[Query]-option; a separate attribute reads clearer and matches Retrofit.
Acceptance criteria
A parameter renders as a bare ?name flag; collections render as repeated names.
Works in reflection + generated paths.
TUnit tests for scalar and collection cases; README/docs entry.
Pointers
Query building: src/Refit/RequestBuilderImplementation.QueryAndHeaders.cs and .Helpers.cs.
Attribute examples to mirror: src/Refit/QueryAttribute.cs.
Type-safe REST API clients for .NET, generated from annotated interfaces with build-time source generation, direct request construction, System.Text.Json defaults, and support for trimming and AOT.
Activity
feat!: reflection-free source-generated request building (#2210)
glennawatson commentedon Jul 15, 2026
This is addressed in the Refit 14 beta, now available on NuGet: https://www.nuget.org/packages/Refit/14.0.0-beta.1
Please give it a try - feedback ahead of the stable 14.0.0 release is very welcome.
github-actions commentedon Jul 30, 2026
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.