We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
According to the docs "Uploads can be used in mutations via the Upload scalar. The type passed at runtime depends on the integration"
Using the Sanic framework I register the view provided by strawberry
from strawberry.sanic.views import GraphQLView class AuthGraphQLView(GraphQLView): decorators = [login_required] if environ.get("BUILD_TARGET") != "dev" else None async def get_context( self, request: AdminRequest, response: TemporalResponse ) -> GraphQLContext: return { "request": request, "response": response, "resource_manager": request.app.ctx.resource_manager, } graphql_blueprint = Blueprint("graphql", url_prefix="/graphql") graphql_blueprint.add_route( AuthGraphQLView.as_view( schema=Schema(query=Query, mutation=Mutation), graphql_ide="graphiql", multipart_uploads_enabled=True, ), "/", )
And then I have the mutation endpoint
@strawberry.mutation() def createImage( self, info: strawberry.Info[GraphQLContext], image: typing.Annotated[ strawberry.file_uploads.Upload, strawberry.argument(description="The image file to upload."), ], ) -> schemas.Image: logger.debug(type(image)) # DEBUG: <class '_io.BytesIO'> return info.context["resource_manager"].create_image(image)
By this point the file should be of type sanic.request.File but it's io.BytesIO so it seems it's getting treated as if the server is AIOHTTP.
sanic.request.File
io.BytesIO
AIOHTTP
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the Bug
According to the docs "Uploads can be used in mutations via the Upload scalar. The type passed at runtime depends on the integration"
Using the Sanic framework I register the view provided by strawberry
And then I have the mutation endpoint
By this point the file should be of type
sanic.request.File
but it'sio.BytesIO
so it seems it's getting treated as if the server isAIOHTTP
.System Information
The text was updated successfully, but these errors were encountered: