openapi-to-graphql
openapi-to-graphql copied to clipboard
Does openapi-to-graphql have support for multipart/form-data, aka, file upload?
Well, I want to know that, and if the answer is yes, would you point me to an example on how to use that feature?
@freakpol GraphQL is really built for passing information in JSON format, however, we do have support for non-application/json data. However, this may not be practical for you as it requires you to input the data as a string, rather than from a file. It's more suited for formats like text/plain.
Could you describe your use case? Maybe, we can go off of that and see what we can do.
We are developing a microservice platform, exposing openapi (using loopback 4). Then we have a graphql layer in front on that and the front application is made by another team (react). Now, they ideally want to use graphql for all their queries/mutatios, but some of the features of the platform include to upload files. The react team can use the rest api, off course (and that is what we asked them to do for the upload endpoints, so for now is not a big issue) but it would be great if you add support to deal with multipart/form-data for upload files. Anyway I was looking around and found this https://github.com/jaydenseric/graphql-multipart-request-spec, seems interesting but didn't test it yet. Perhaps you can use that lib to add file upload support. Thank you so much for the rapid response!
@freakpol Ah, I see! Very interesting! This seems to be a great fit for OtG! However, I will have take a deeper look into this topic. To be honest, this is the first time I’ve heard about sending files through a GraphQL interface. Seems to be an interesting concept!
@Alan-Cha Any update on this enhancement?