~theo/gql#26: 
Require matching resolvers

It might be good form to require us to create hash tables with corresponding functions mimicking the shape of the operation types. The resolvers should be functions as values mapped to from field names as keys. Then we can just get them in resolve, can't we?

So, if

# https://spec.graphql.org/draft/#example-19f2a
type Query {
  dog: Dog
}

type Dog implements Pet {
  name: String!
  nickname: String
  barkVolume: Int
  doesKnowCommand(dogCommand: DogCommand!): Boolean!
  isHouseTrained(atOtherHomes: Boolean): Boolean!
  owner: Human
}

Then we need a hash-table such as:

{
  dog: {
    name: (lambda (str) ...)
    nickName: (lambda (str) ...)
    barkVolume: (lambda (int) ...)
    doesKnowCommand: (lambda (dogCommand) ...) ;; from arg-values
    ;; etc...
  }
}

Then we need convenience functions to get these and call them. Might be clean?

Status
REPORTED
Submitter
~theo
Assigned to
No-one
Submitted
6 months ago
Updated
6 months ago
Labels
Execution

~theo 6 months ago*

b006a30 should deal with this, at least as a first attempt. There will be more, surely, so keeping this open for a little while

Register here or Log in to comment, or comment via email.