FSharp.Data.GraphQL icon indicating copy to clipboard operation
FSharp.Data.GraphQL copied to clipboard

File upload support

Open ivelten opened this issue 7 years ago • 8 comments

With this PR, I am adding an experimental tool package for working with AspNetCore using this multipart request spec to enable a file upload feature using GraphQL.

The idea behind the component is to provide a MultipartRequest object that will be parsed from a MultipartReader. This parsing operation will automatically fill the file into the variables object, enabling user code to fetch the stream from the resolver function of a mutation field, for example.

  • [x] Create an input object for file upload
  • [x] Create a MultipartRequest object
  • [x] Create a routine to read multipart requests and parse them to the MultiparseRequest object
  • [x] Automated tests
  • [x] Update sample server
  • [x] Create nuget package
  • [x] Create documentation

ivelten avatar Oct 10 '18 20:10 ivelten

@Horusiath I did all the changes you asked for. About JSON.NET dependency, yeah, as this component is designed for ASP.NET Core and Microsoft already adopted this library, I don't think this is an issue in this case.

ivelten avatar Nov 15 '18 13:11 ivelten

Apparently done, I'm waiting this to be merged :)

Rajivhost avatar Jan 09 '19 12:01 Rajivhost

@ivelten, does this functionality work? Could you rebase it onto the latest dev?

xperiandri avatar May 13 '20 17:05 xperiandri

@xperiandri it was working when I finished the PR. If everyone decides to restart this PR, I can try rebasing and/or adjusting minor issues on it next weekend.

ivelten avatar May 13 '20 17:05 ivelten

@aggieben, @johnberzy-bazinga, any objections?

xperiandri avatar May 13 '20 17:05 xperiandri

I don't object to the PR, but I'd think you'd want to rebase before merging

aggieben avatar May 13 '20 17:05 aggieben

I'd hold off on rebasing this. I'm working on a middleware that uses System.Text.Json that also supports File uploads. The goal is to remove the boilerplate by supporting something like:

app.UseGraphQL(...)

It's close to being done, but on problem I ran into with System.Text.Json is it doesn't have anything analogues to JObject.FromObject so it's trickier to support the replacements by jsonpath that are needed for multipart file uploads.

johnberzy-bazinga avatar May 13 '20 17:05 johnberzy-bazinga

I suppose that according to the sample in this repo it is already done, right?

xperiandri avatar Mar 18 '21 21:03 xperiandri