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
Correct, documentation should be fixed to show that middlewares should be passed to manager as list. Could you please contribute a PR fixing this?
Starting with Ariadne 0.18 we split middleware option into middlewares (which we expect to be a list of middlewares) and middleware manager class. I'll put this for that release so I remember to check if MyPy is complaining after changes.
Adding Middlewares to ASGI GraphQL as documented in https://ariadnegraphql.org/docs/middleware#custom-middleware-example doesn't work.
This is the example from docs at the time of writing this issue:
Firts,
mypy
will throw following error:Second, running this code will throw following error:
By looking at the expected type I've tried:
It does satisfy
mypy
, but when the code is run the middlewares aren't ever getting called.By looking at the test suite:
https://github.com/mirumee/ariadne/blob/9a6cd62c9172b5e43cc62cccdec9f28294d7238d/tests/asgi/test_configuration.py#L589..L621
For example in this part:
I've noted, that you use a different syntax. This one is working, but it contradicts the doc and doesn't work with static type checking.
From
mypy
you will get following error:Workaround that I've found is to do:
I'd suggest adding type annotations to the test suite and run mypy on it.
The text was updated successfully, but these errors were encountered: