Skip to content

Conversation

@jml
Copy link
Collaborator

@jml jml commented Jan 16, 2017

As discussed, new functions in top-level GraphQL module:

  • executeQuery
  • interpretQuery
  • interpretAnonymousQuery

These all have copious (but not necessarily good) documentation. Please check the Haddock documentation generated by Circle to confirm that it's readable in context.

I've deleted the filesystem example, as discussed. I've updated the other examples to refer to interpretAnonymousQuery, along with making some other changes to improve their documentation.

getOperation and SelectionSet are no longer exposed at the top-level.

TypeApiTests (which should really be renamed to ResolverTests) also got a bit of a tidy up. I'm not sure what the point of the custom monad is any more, but it's there anyway.

Fixes #60

=> Handler m api -- ^ Handler for the query. This links the query to the code you've written to handle it.
-> QueryDocument VariableValue -- ^ A validated query document. Build one with 'compileQuery'.
-> Maybe Name -- ^ An optional name. If 'Nothing', then executes the only operation in the query. If @Just "something"@, executes the query named @"something".
-> VariableValues -- ^ Values for variables defined in the query document. A map of 'Variable' to 'Value'.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add how to construct VariableValues in the docstring?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I started to do this and realised that we don't have a great story for it. Separate PR.

Choose a reason for hiding this comment

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

I'm looking for how to accomplish this now, but don't see any new information. Is the mentioned PR available?

-- >>> import Data.Aeson (encode)
-- >>> import GraphQL.Value.ToValue (ToValue(..))

-- TODO: jml thinks it's a bit confusing to have `show` output in these
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure what the TODO is here. Tests seem fine to me?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The braces & quotes within the string within the JSON confuse me a little syntactically. Hard to explain beyond what I've already commented. Have just done the TODO in 88056e4. Let me know if a) that clarifies what I meant by the TODO, b) you think that makes the example more effective.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will merge this change as-is, but please do let me know if you want it changed again.


-- | Execute a GraphQL query.
executeQuery
:: forall api m. (HasGraph m api, Applicative m)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We discussed adding an Object n i f ~ api constraint to make sure executeQuery can run only on Objects. Up to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Separate PR? Also, overnight I thought that that an IsQueryRoot constraint (with a resolveRoot :: Handler m a -> m Object method) wouldn't be such a bad thing.

@jml jml merged commit 8193a85 into master Jan 17, 2017
@jml jml deleted the top-level branch January 17, 2017 08:39
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

Successfully merging this pull request may close these issues.

4 participants