FSharp.Data.GraphQL
FSharp.Data.GraphQL copied to clipboard
File upload support
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
@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.
Apparently done, I'm waiting this to be merged :)
@ivelten, does this functionality work? Could you rebase it onto the latest dev?
@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.
@aggieben, @johnberzy-bazinga, any objections?
I don't object to the PR, but I'd think you'd want to rebase before merging
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.
I suppose that according to the sample in this repo it is already done, right?