Skip to content

Order of Middlewares #155

Open
Open
@dfee

Description

@dfee

I've discovered that this line inverts the middleware order:
https://github.com/graphql-python/graphql-core/blob/6df8a6312b579a6a1454bcf29a566ce5d0fa9849/graphql/execution/middleware.py#L51

This was somewhat confusing, as I expected the first installed middleware to be the entrypoint. I.e.

schema.execute(
    statement,
    middleware=[mw1, mw2],
)

actually produces the call stack mw2 -> mw1 -> resolve_func, whereas i'd expected mw1 -> mw2 -> resolve_func.

I'm not clear if this is a bug, as this functionality isn't tested anywhere, or if it would just go in documentation somewhere.

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