When using strawberry.file_uploads.Upload
with asgi, it seems that no type checking at all is performed on the input.
Test server:
import strawberry
from strawberry.asgi import GraphQL
from strawberry.file_uploads import Upload
@strawberry.type
class Query:
@strawberry.field
def upload(self, file: Upload) -> str:
return "success"
schema = strawberry.Schema(query=Query)
application = GraphQL(schema)
Start server with uvicorn server:application
The following commands all return "success":
curl "http://127.0.0.1:8000" -F operations='{ "query": "query($file: Upload!){ upload(file: $file) }", "variables": { "file": null } }' -F map='{ "file": ["variables.file"] }' -F file="@testfile"
=> expected
curl "http://127.0.0.1:8000" -F operations='{ "query": "query($file: Upload!){ upload(file: [$file]) }", "variables": { "file": null } }' -F map='{ "file": ["variables.file"] }' -F file="@testfile"
=> this is a list?
curl "http://127.0.0.1:8000" -F operations='{ "query": "query{ upload(file: 1) }" }'
=> ??
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too