Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scalar_override example to File Upload #3389

Merged
merged 2 commits into from
Mar 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/guides/file-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ runtime depends on the integration:
| [Sanic](/docs/integrations/sanic) | [`sanic.request.File`](https://sanic.readthedocs.io/en/stable/sanic/api/core.html#sanic.request.File) |
| [Starlette](/docs/integrations/starlette) | [`starlette.datastructures.UploadFile`](https://www.starlette.io/requests/#request-files) |

In order to have the correct runtime type in resolver type annotations you can
set a scalar override based on the integrations above. For example with
Starlette:
```python
import strawberry
from starlette.datastructures import UploadFile
from strawberry.file_uploads import Upload

schema = strawberry.Schema(
...
scalar_overrides={UploadFile: Upload}
)
```

## ASGI / FastAPI / Starlette

Since these integrations use asyncio for communication, the resolver _must_ be
Expand Down