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

default params break the compileFieldArgs function #59

Open
capaj opened this issue Aug 24, 2018 · 0 comments
Open

default params break the compileFieldArgs function #59

capaj opened this issue Aug 24, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@capaj
Copy link
Contributor

capaj commented Aug 24, 2018

I have a field like this:

@Field({ type: UserEventModel })
  async inviteUser(
    @Context ctx: UserSessionModel,
    userId: number,
    attending: boolean,
    sendInviteEmail: boolean = true
  ): Promise<UserEventModel> {
    ... some implementeation
  }

when I run this, I get:

Error: Expected undefined to be a GraphQL nullable type.
    at invariant (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/graphql/jsutils/invariant.js:19:11)
    at assertNullableType (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/graphql/type/definition.js:327:51)
    at new GraphQLNonNull (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/graphql/type/definition.js:294:19)
    at enhanceType (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:635:21)
    at /home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:662:25
    at Array.forEach (<anonymous>)
    at convertArgsArrayToArgsMap (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:653:14)
    at compileFieldArgs (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:687:12)
    at compileFieldConfig$$1 (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:760:16)
    at /home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:787:39
    at Array.forEach (<anonymous>)
    at getAllFields (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:782:25)
    at /home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:795:39
    at Array.forEach (<anonymous>)
    at compileAllFields$$1 (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:794:23)
    at /home/capaj/git_projects/looop/project-alpha/back-end/node_modules/@capaj/typegql/lib/index.js:829:16

when I put a log into
function convertArgsArrayToArgsMap(target, fieldName, argsTypes, registeredArgs) {

the last 4 argument name's are:

argName:  userId
originalType:  Float
argName:  attending
originalType:  Boolean
argName:  sendInviteEmail
originalType:  Boolean
argName:  [
originalType:  undefined

of course when I remove the default argument value, it all works.

@pie6k pie6k added the bug Something isn't working label Aug 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants