Skip to content

feat: add CollectionFormat.Indexed for indexed query collection expansion#2262

Merged
glennawatson merged 20 commits into
reactiveui:mainfrom
jgarciadelanoceda:feature_2256_Indexed
Jul 21, 2026
Merged

feat: add CollectionFormat.Indexed for indexed query collection expansion#2262
glennawatson merged 20 commits into
reactiveui:mainfrom
jgarciadelanoceda:feature_2256_Indexed

Conversation

@jgarciadelanoceda

@jgarciadelanoceda jgarciadelanoceda commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature Closes #2256

What is the new behavior?

Adds a new CollectionFormat.Indexed value that expands an IEnumerable of complex objects into indexed key-prefix query parameters:
?items[0].Id=1&items[0].Value=a&items[1].Id=2

Both the source generator (inline, zero-reflection) and the reflection request builder paths are implemented. The generator parses an IEnumerable parameter with CollectionFormat.Indexed and a complex element type into the new QueryParameterShape.DeepObjectCollection shape, emitting a loop with an incrementing index local and flattening each element's properties under the key[index].Property naming scheme.

What is the current behavior?

It was possible with QueryFormatter

What might this PR break?

n/a

Checklist

  • I have read the Contribute guide
  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Javier García de la Noceda Argüelles and others added 2 commits July 20, 2026 02:10
…sion

Adds a new CollectionFormat.Indexed value that expands an IEnumerable<T>
of complex objects into indexed key-prefix query parameters:
  ?items[0].Id=1&items[0].Value=a&items[1].Id=2

Both the source generator (inline, zero-reflection) and the reflection
request builder paths are implemented. The generator parses an
IEnumerable<T> parameter with CollectionFormat.Indexed and a complex
element type into the new QueryParameterShape.DeepObjectCollection shape,
emitting a loop with an incrementing index local and flattening each
element's properties under the key[index].Property naming scheme.

Closes reactiveui#2256

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jgarciadelanoceda
jgarciadelanoceda marked this pull request as draft July 20, 2026 00:15
Comment thread src/tests/.editorconfig Outdated
@jgarciadelanoceda
jgarciadelanoceda marked this pull request as ready for review July 20, 2026 14:17
@glennawatson

Copy link
Copy Markdown
Contributor

For src/Refit.Reflection/RequestBuilderImplementation.Payload.cs. Sorry for jumping in the same file was attempting to avoid it but see how you go merging, mostly that was for the allocation reduction work.

@glennawatson glennawatson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid approach - both the inline generator and reflection paths, docs, tests, and full public-API coverage. A few things before merge:

Comment thread src/InterfaceStubGenerator.Shared/Emitter.Inline.Query.Object.cs
Comment thread src/Refit.Reflection/RequestBuilderImplementation.Payload.cs
Comment thread src/Refit.Reflection/RequestBuilderImplementation.Payload.cs
Comment thread src/InterfaceStubGenerator.Shared/Parser.Request.Query.cs Outdated
Javier García de la Noceda Argüelles and others added 2 commits July 21, 2026 12:30
@glennawatson
glennawatson merged commit 88d5e68 into reactiveui:main Jul 21, 2026
13 checks passed
@glennawatson

Copy link
Copy Markdown
Contributor

Thanks, will likely be another 14.0 beta release tomorrow with this change in it.

@jgarciadelanoceda
jgarciadelanoceda deleted the feature_2256_Indexed branch July 21, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CollectionFormat DeepObject applicable to IEnumerable<object>

2 participants