Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Conversation

@aweiker
Copy link
Member

@aweiker aweiker commented Jan 13, 2016

During plug initialization, allows a function to be defined that will
take a conn as input and then return a data structure that can be
used as the root_value into the GraphQL.execute method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The callback needs to be in the same {module, function} format as the schema otherwise Phoenix code reloading messes with it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note regarding this, currently the function is being pulled out and executed in the init function for grabbing the schema. For this function, I will need to make the evaluation and execution happen in call instead. Otherwise, we would never execute it per request or get the conn reference.

@joshprice
Copy link
Member

Thanks for the PR! See comments, but otherwise looks great.

@aweiker
Copy link
Member Author

aweiker commented Jan 18, 2016

I'm adding the comments and have most of them addressed. Do you prefer getting it rebased into a single commit, or do you want to see a new commit?

@joshprice
Copy link
Member

Not too fussed about squashing commits, but this will need to be rebased on top of the new changes. Sorry I couldn't get this merged in before I refactored things. Ping me on Slack if you need a hand or have any questions.

The other thing that is missing is variables, which is pretty much the same as root_value so if you feel like adding that, cool, otherwise it's easy to add once this is merged.

During plug initialization, allows a function to be defined that will
take a conn as input and then return a data structure that can be
used as the root_value into the GraphQL.execute method.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just match nil no guard needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specify arity 1 in is_function

@joshprice joshprice changed the title Allow root_value to be passed along to GraphQL.execute. Allow root_value to be passed along to GraphQL.execute Jan 19, 2016
@joshprice
Copy link
Member

Awesome thanks again!

joshprice pushed a commit that referenced this pull request Jan 19, 2016
Allow root_value to be passed along to GraphQL.execute
@joshprice joshprice merged commit b1c4554 into graphql-elixir:master Jan 19, 2016
@aweiker aweiker deleted the plug-options branch January 19, 2016 19:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants