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 GraphQL arguments are not passed into setupFunctions #49

Closed
kouak opened this issue Mar 10, 2017 · 3 comments
Closed

Default GraphQL arguments are not passed into setupFunctions #49

kouak opened this issue Mar 10, 2017 · 3 comments

Comments

@kouak
Copy link
Contributor

kouak commented Mar 10, 2017

Hello,

Versions used

  • master@341482dc982983f4904b7fee51e672820f376830

Setup

When defining setup functions like this :

  setupFunctions: {
    commentAdded: (options, args) => ({
      newCommentsChannel: {
        filter: comment => comment.repository_name === args.repoFullName,
      },
    }),
  },

I might be wrong here, since I'm not really familiar with graphql-subscriptions but I assume args represents the graphql arguments passed into the subscription query.

Considering this query :

subscription CommentAdded {
  commentAdded(feed: 1234) {
    ...
   }
}

args will be properly set to the expected value :

{ feed: 1234 }

However, when default arguments are defined in the schema like this :

type RootSubscription {
  commentAdded(
    feed: Int = 10
  ): Comment!
}

args will not be set to { feed: 10 } as one would expect.

Actual outcome

args is set to

{}

Expected outcome

args set to

{ feed: 10 }

Failing test

I forked and created a failing test case demonstrating the issue. See here : kouak@820101a

Let me know if you want me to submit a PR with this failing test case.

@NeoPhi
Copy link
Contributor

NeoPhi commented Mar 11, 2017

@Urigo Not sure how you feel about pulling in a function that isn't exported by default but handles all of the internals of arguments.

Urigo added a commit that referenced this issue Mar 17, 2017
@Urigo
Copy link
Contributor

Urigo commented Mar 17, 2017

@kouak fixed by @NeoPhi in #50 , we'll release a new version this week.

@Urigo Urigo closed this as completed Mar 17, 2017
@Urigo
Copy link
Contributor

Urigo commented Mar 17, 2017

released as 0.3.1

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

3 participants