jaydenseric / graphql-multipart-request-spec

A spec for GraphQL multipart form requests (file uploads).
993 stars 54 forks source link

Variables #22

Closed tupikoff closed 5 years ago

tupikoff commented 5 years ago

Why the spec doesn't propose to use variables along with the files upload? Here https://github.com/eko/graphql-go-upload it was implemented and it seems quite reasonable.

jaydenseric commented 5 years ago

Because we need to support batching:

https://github.com/jaydenseric/graphql-multipart-request-spec#batching

Multiple operations with seperate sets of variables (that could have the same names) can be batched in one multipart request.

jaydenseric commented 5 years ago

Also, if variables are in multipart form fields separate to the operation, because all the variables need to be collected one after the other, it becomes impossible to run the resolvers and while the files are still streaming up like in the async case:

Sync vs async GraphQL multipart request middleware

I recommend that graphql-go-upload support this spec, that way they will be compatible with all the other implementations in the GraphQL ecosystem.