Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GraphQL uploads via multipart form spec #103

Merged
merged 2 commits into from
Dec 29, 2023

Conversation

gmac
Copy link
Owner

@gmac gmac commented Dec 19, 2023

This adds multipart form extraction to HttpExecutable, which enables GraphQL uploads. Resolves #101, as proposed by @mikeharty.

Extractor

The following variables...

a = Tempfile.new
b = Tempfile.new

{
  "input"=>{"file"=>a, "files"=>[a, b]},
  "inputs"=>[
    {"file"=>a, "files"=>[a, b]}, 
    {"file"=>a, "files"=>[a, b]}
  ]
}

Extract into the following multipart form mapping...

{
  "map"=> {
    "0"=> [
      "variables.input.file",
      "variables.input.files.0",
      "variables.inputs.0.file",
      "variables.inputs.0.files.0",
      "variables.inputs.1.file",
      "variables.inputs.1.files.0"
    ],
    "1"=> [
      "variables.input.files.1", 
      "variables.inputs.0.files.1", 
      "variables.inputs.1.files.1"
    ]
  },
  "0"=>"A",
  "1"=>"B",
}

@gmac gmac changed the base branch from main to v1_2_0 December 28, 2023 02:52
@gmac gmac force-pushed the multipart_form_extractor branch 2 times, most recently from f440a1d to c328807 Compare December 29, 2023 01:50
@gmac gmac marked this pull request as ready for review December 29, 2023 03:48
@gmac gmac changed the title Multipart form extractor Support GraphQL uploads via multipart form spec Dec 29, 2023
@gmac gmac merged commit e524eda into v1_2_0 Dec 29, 2023
@gmac gmac deleted the multipart_form_extractor branch December 29, 2023 04:01
@gmac gmac mentioned this pull request Dec 29, 2023
@mikeharty
Copy link
Contributor

Hey @gmac, I wanted to say thanks for getting this in! I didn’t intend for this to be a drive-by feature request, I had a shift in priorities after the holidays and was totally preoccupied. Thanks for the help with this and the other features we discussed, the project I was working on is now a running a Supergraph in production built on this. 👍🏻

@gmac
Copy link
Owner Author

gmac commented May 11, 2024

@mikeharty awesome! This was a cool feature and I learned a lot about GraphQL upload building it. Thanks for the prototype and introduction. Great to hear that it’s running in the wild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants