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

Additional fields on interface implementer do not set default values #154

Open
tonyghita opened this issue Jan 26, 2018 · 0 comments
Open

Comments

@tonyghita
Copy link
Member

tonyghita commented Jan 26, 2018

Expected behavior

Given the schema

interface Namer {
  name: String!
}

type User implements Namer {
  id: ID!
  name(type: NameType = FULL): String!
  email: String!
}

enum NameType {
  FULL
  FIRST
  LAST
}

type Query {
  namedThings: [Namer]
}

and the query

{
  namedThings {
     name
  }
}

I would expect the name field resolver to receive the default argument value for the argument type when the Namer being resolved is a User.

func (r *UserResolver) Name(args *struct{Type string}) string {
  switch args.Type {
   case "":
     panic("argument 'type' should have a value!")
   default:
     // the value was set, continue
  }

  return ""
}

Actual behavior

The value of the type argument is un-set. If the field resolver was written as above, the panic would be triggered.

Relevant links

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

No branches or pull requests

1 participant