-
Notifications
You must be signed in to change notification settings - Fork 16
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 support for GraphQL Multipart Uploads #158
Comments
@siopaonow If I'm being honest, I'm not a user of GraphQL myself, and by extension not very familiar with usage patterns in the community, so: Could you provide a full sample / minimal use case w/ code snippets demonstrating how we'd want this to be used, and how things would get plugged in together on the user side? We'd need to clarify if this involves adding / changing public-facing APIs, and then decide what those should be. |
I think this change should be able to be introuduced in a non-breaking way with an:
As for some examples on how this would be used on the users end: from tartiflette import Resolver
from tartiflette_asgi import TartifletteApp
@Resolver("Query.file")
async def file(parent, args, context, info):
uploaded_file = args["upload"]
return uploaded_file.filename
sdl = "type Query { file(upload: Upload): String }"
app = TartifletteApp(sdl=sdl, upload=True) Tartiflette Engine instance from tartiflette import Engine
engine = Engine(
sdl=...,
modules=[
"tartiflette_asgi.upload",
]
)
app = TartifletteApp(engine=engine, upload=True) Let me know if anything is unclear or any further details are required. |
Thanks for these pointers! So, it's unclear to me if this should be in tartiflette-asgi, OR in tartiflette itself. Things like "a scalar in the schema" are related to the GraphQL engine, rather than the web layer.
|
I believe this has to be part of tartiflette-asgi, as prior to the query being executed by the engine, we need parse and 'mutate' the sent query to insert the upload files from the request. Details on the multipart structure can be found here and a few example requests can be found here. Hopefully that helps clarify. In answer to your questions:
|
@siopaonow Thanks. I think at this point if you want to have a try at a draft PR to illustrate what that would look like, that would be a nice next step. :-) Let's remember that Starlette already has a multipart parser, available as |
Wondering if it would be in the scope of this library support for GraphQL Multipart Uploads as per: https://github.com/jaydenseric/graphql-multipart-request-spec? More than happy to give writing an implementation a go and submittined a PR.
Reference Python implementations:
The text was updated successfully, but these errors were encountered: