Skip to content

Forward custom field arguments (**kwargs) from StrawberryDjangoConnectionExtension.resolve to connection_type.resolve_connection #790

@stygmate

Description

@stygmate

Summary

When using StrawberryDjangoConnectionExtension with a custom connection class that expects additional arguments (e.g., a search_query string used to pre-filter/annotate a queryset before Relay pagination), those extra arguments are not forwarded from the extension’s resolve method to connection_type.resolve_connection. As a result, custom arguments accepted by the GraphQL field are effectively ignored by the connection resolution step unless developers override the extension themselves.

Current behavior

StrawberryDjangoConnectionExtension.resolve accepts **kwargs in its signature and passes them to the field’s resolver (next_), but does not forward them to self.connection_type.resolve_connection. Only pagination args (before, after, first, last) and max_results are forwarded.

Relevant excerpt (sync path shown; async path mirrors the same):

return self.connection_type.resolve_connection(
    nodes,
    info=info,
    before=before,
    after=after,
    first=first,
    last=last,
    max_results=self.max_results,
)

resolved = self.connection_type.resolve_connection(

return self.connection_type.resolve_connection(

This prevents any custom field args (e.g., search_query) from reaching a custom connection implementation that would use them to modify the queryset before pagination.

Expected behavior

StrawberryDjangoConnectionExtension.resolve should forward **kwargs to connection_type.resolve_connection in both sync and async branches. This allows custom connection implementations to opt-in to additional arguments without requiring an extension override.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions