peburrows / plot

A graphql parser and resolver for Elixir
32 stars 2 forks source link

Make Plot.Arg match what parser delivers #2

Closed BjRo closed 8 years ago

BjRo commented 8 years ago

Hey!

We're currently playing around with plot during a hackathon at XING and really like what you've done so far with the library. However we've run into a roadblock with arguments which this pull request attempts to fix.

The current code of Plot.Arg doesn't match what get's delivered by the generated parser. It gives you a bad match when trying to assign the parsed structure to Plot.Arg. The code in the tests for Plot.Arg indicates that you want the parser to deliver a keyword list / list of tagged tuples.

We thought parsing out atoms out of user supplied code doesn't seem like a good idea, because afaik the atom table is not garbage collected (Please correct me if I'm wrong here). That's why we changed the code back to parse out the arguments as binaries/strings.

This fixes the bad match and makes the whole Plug.parse_and_generate work end-2-end for that case.

What do you think?

peburrows commented 8 years ago

Awesome, thank you for this! (And yes, you are correct, atoms don't get garbage collected.)