Feature Request: Support for Embedded Structs in Query Parameters #2319
Lenstack
started this conversation in
Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Encore doesn't recognize embedded structs when parsing query parameters or generating API docs, forcing developers to duplicate common fields across every endpoint.
What doesn't work:
Result:
pageandlimitdon't appear in docs and aren't parsed.Current workaround (requires duplication):
Expected Behavior
Encore should process embedded struct fields with
query:tags just like Go's standard library does:All fields (including embedded) should:
Impact
Without this feature:
With this feature:
Use Cases
Common reusable patterns that need this:
PageRequest)FilterRequest)SortRequest)Technical Note
Go's
encoding/jsonand reflection properly handle embedded structs. Encore's compile-time code generation should do the same by recursively traversing embedded fields when analyzing request structs.This limitation breaks Go's composition idioms and forces non-idiomatic workarounds. Supporting embedded structs would align Encore with Go conventions and significantly reduce boilerplate.
All reactions