jaydenseric / graphql-multipart-request-spec

A spec for GraphQL multipart form requests (file uploads).
991 stars 54 forks source link

Switch to the JSON Pointer standard for `map` field operations paths #56

Open jaydenseric opened 2 years ago

jaydenseric commented 2 years ago

The IETF RFC 6901 “JSON Pointer” spec defines a string syntax for identifying a specific value within a JSON document.

Ideally, the GraphQL multipart request spec would use JSON pointer strings instead of less standard object-path strings for operations paths in the map field array.

Here is an example of the difference for the map field JSON for the batching example:

  {
    "0": [
-     "0.variables.file"
+     "/0/variables/file"
    ],
    "1": [
-     "1.variables.files.0"
+     "/1/variables/files/0"
    ],
    "2": [
-     "1.variables.files.1"
+     "/1/variables/files/1"
    ]
  }

Benefits of switching to the JSON Pointer format:

Cons:

The benefits don't enable new features or capability and are probably not worth the pain. Until now there have been few, if any, complaints about the format for operations paths. It might make sense to leave this spec as it is until it moves to an official GraphQL Foundation GraphQL over HTTP spec (see https://github.com/graphql/graphql-over-http/issues/7).

Nickyle commented 2 years ago

can you help me with wpgraphql upload file from my computer. Thanks you so much! :(((

jaydenseric commented 2 years ago

@Nickyle this issue is not the right topic for a question like that. And to answer to your question, I can't really help you as I don't have experience with WPGraphQL. Good luck though; I hope you figure out the answers.