Skip to content

Fix the input object example #177

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

Merged
merged 1 commit into from
Aug 21, 2018
Merged

Conversation

harendra-kumar
Copy link
Contributor

No description provided.

@@ -48,7 +48,7 @@ example = interpretAnonymousQuery @Query root

main :: IO ()
main = do
response <- example "{ description(dogStuff: {toy: \"bone\", likesTreats: true}) }"
response <- example "{ description(dogStuff: {_toy: \"bone\", _likesTreats: true}) }"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR!

I'm not entirely sure what's going on here. Is there a bug for reference? Can you maybe add a description to the commit message for why the example didn't work before and why it works with this fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fields in the original data structure are named with underscores and here are they are being used without underscores. That was the problem.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What breaks because of this?

@harendra-kumar
Copy link
Contributor Author

It generates this output without the change:

{"data":{"description":null},"errors":[{"message":"Could not coerce Name {unName = \"dogStuff\"} to valid value: Key not found: Name {unName = \"_toy\"}"}]}
{"data":{"description":"their favorite toy is a shoe"}}

With the change:

{"data":{"description":"likes treats and their favorite toy is a bone"}}
{"data":{"description":"their favorite toy is a shoe"}}

Copy link
Collaborator

@jml jml left a comment

Choose a reason for hiding this comment

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

Really we should make these automated tests or something.

@jml jml merged commit 3a0601a into haskell-graphql:master Aug 21, 2018
@jml
Copy link
Collaborator

jml commented Aug 21, 2018

We had both approved this, and there were no outstanding comments, so I merged it.

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.

3 participants