You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An interoperable multipart form field structure for GraphQL requests, used by various file upload client/server implementations.
From the spec, the PR contains the implementation to handle the "Single file" and "File list" examples. It doesn't implement the "Batching" example.
The main points of the proposal are:
When a user submits an http request with multipart/form-data contentType, then it's assumed that the user is doing a request that involves uploading one or more files, and the payload will be parsed accordingly.
The submitted Form should have 2 keys: operations and map.
The operation value should be the usual operation json.
The map value, as the name says, should be a map, where it's keys are the uploaded file number and the values are the operation variable path where the file should be injected.
The changes in the pull request are:
Add graphql.Upload scalar that would be used to Marshal and Unmarshal a file Upload (graphql/upload.go file).
Add Upload as an additional types that will be injected if defined in the schema as scalars (codegen/config/config.go file).
Modify the handler so only if the request is a multipart/form-data contentType, it's parsed accordingly (handler/graphql.go).
Add uploadMaxMemory parameter to Config to define how much of the request body to keep in memory before stating to store on disk (handler/graphql.go).
Add fileupload example (example/fileupload folder).
Update docs (Update docs/content/reference/scalars.md and add docs/content/reference/file-upload.md)
It would be nice to support file upload using graphql.
This, https://github.com/jaydenseric/graphql-multipart-request-spec, is an unofficial spec that has been implemented by various providers.
As the spec says
From the spec, the PR contains the implementation to handle the "Single file" and "File list" examples. It doesn't implement the "Batching" example.
The main points of the proposal are:
When a user submits an http request with multipart/form-data contentType, then it's assumed that the user is doing a request that involves uploading one or more files, and the payload will be parsed accordingly.
The submitted Form should have 2 keys: operations and map.
The operation value should be the usual operation json.
The map value, as the name says, should be a map, where it's keys are the uploaded file number and the values are the operation variable path where the file should be injected.
The changes in the pull request are:
PR #655
Fixes #342
The text was updated successfully, but these errors were encountered: