haskell-graphql / graphql-api

Write type-safe GraphQL services in Haskell
BSD 3-Clause "New" or "Revised" License
406 stars 35 forks source link

Top-level function to take queries and return responses #60

Closed jml closed 7 years ago

jml commented 7 years ago

We have parsing, validation, resolving, and a response object. We need to string them all together.

Notes:

the 'schema' is defined by the server types, an initial value, and any supported directives (although we'll probably skip those for first release) -- so that's the server's input

the client's input is a query document, a variable map, and an optional name of an operation to run. Not sure how these are actually delivered to us.

the output is the Response object in our Output.hs module

overall process is:

  1. parse query (if it fails, respond with PreExecutionFailure)
  2. transform the AST into something valid, ignoring type checks, but making sure that arguments aren't duplicated, no circular references. (if fail, PreExecutionError) Note that we don't need the schema or the variables yet.
  3. substitute in the variables. now everything is literal.
  4. apply the directives. probably hard-code @skip & @include for the first release. if fail, execution error, and continue with fragments without bad directives We now have something that's just objects & fragments
  5. "collect the fields" to avoid duplicate processing (c.f. https://facebook.github.io/graphql/#sec-Field-Collection). still not 100% sure about this.
  6. delegate to server-supplied code, collecting any results and errors
  7. wrap whatever we've got off in a Response
jml commented 7 years ago

66 touches on this.

jml commented 7 years ago

59 is item 5 in the original list.