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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/InputObject.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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?

putStrLn $ Aeson.encode $ toValue response
response' <- example "{ description }"
putStrLn $ Aeson.encode $ toValue response'