Graphql-playground: File upload support

Created on 1 Dec 2017  路  5Comments  路  Source: graphql/graphql-playground

File upload is becoming more and more a common feature in GraphQL APIs while debugging file handling is always quite painful. It would be great if the playground supports file upload out of the box, so it's easier to debug when needed.

Would be great to hear about design ideas for this!

kindiscussion rf0-needs-spec rf1-draft

Most helpful comment

It seems like the approach to handling files should be similar to how authorization is handled. They only need to be added to the http request and then the user can obtain them and add them to context using something like multer.

I think an additional panel called __Files__ that is placed right next to __Query Variables__ and __HTTP Headers__ would be sufficient. In this panel users should be able to add an array of files to the request using drag and drop or the <input type="file" /> input.

All 5 comments

I think the only file upload scenario that remotely has something to do with a GraphQL Playground would be a GraphQL server that implements it as a GraphQL mutation. I know it's possible by spec, but I have not come across any implementation.

If this goes beyond basic GraphQL, I think it should be a separate module/plugin, that you can use in the middleware version, to extend functionality that makes sense for how you have built your gateway.

It seems like the approach to handling files should be similar to how authorization is handled. They only need to be added to the http request and then the user can obtain them and add them to context using something like multer.

I think an additional panel called __Files__ that is placed right next to __Query Variables__ and __HTTP Headers__ would be sufficient. In this panel users should be able to add an array of files to the request using drag and drop or the <input type="file" /> input.

Very needed feature. In IDE maybe by providing path to file in input?

I've tried to solve the File upload with GraphQL in Firecamp. Feel free to share your thoughts - https://doc.firecamp.io/graphql/a/uploading-file-within-graphql-request/

File upload in GraphQL

Was this page helpful?
0 / 5 - 0 ratings