Live data from Hacker News

GraphQL Working Draft

facebook.github.io

1–10 of 71 posts

Re: GraphQL Working Draft

#4
Why not have the query in JSON? Now you need a new parser.

EDIT: Thanks for all the replies, all of them very good points, and clearly show that JSON is not the most elegant option for a complex DSL.

Re: GraphQL Working Draft

#5

Why not have the query in JSON? Now you need a new parser. EDIT: Thanks for all the replies, all of them very good points, and clearly show that JSON is not the most elegant option for a complex DSL.

There are certain things that are a bit more elegant if you can have a custom query language. One example:

        query UseFragment {
          luke: human(id: "1000") {
            ...HumanFragment
          }
          leia: human(id: "1003") {
            ...HumanFragment
          }
        }
        fragment HumanFragment on Human {
          name
          homePlanet
        }
You could definitely have some JSON to represent this but it might turn out to be more trouble than it's worth...

Re: GraphQL Working Draft

#6

Why not have the query in JSON? Now you need a new parser. EDIT: Thanks for all the replies, all of them very good points, and clearly show that JSON is not the most elegant option for a complex DSL.

the query contains by far more logic than should be put into json

you could map it to json - but technically you could map everything to json - doesnt mean you decrease complexity

the parser is the lowest problem of parsing and optimizing those queries i'd assume

Re: GraphQL Working Draft

#7

Why not have the query in JSON? Now you need a new parser. EDIT: Thanks for all the replies, all of them very good points, and clearly show that JSON is not the most elegant option for a complex DSL.

Readability I guess. The new syntax looks pretty good to me. A little heavy on the (( and )) but very obvious as to what is being asked.

Re: GraphQL Working Draft

#9

Why not have the query in JSON? Now you need a new parser. EDIT: Thanks for all the replies, all of them very good points, and clearly show that JSON is not the most elegant option for a complex DSL.

I'm guessing you might want some 'small' parts of logic, like the unary operation. Guessing!

Re: GraphQL Working Draft

#10
There was a comment on the original blog post that while they (Facebook) use GraphQL they still fall back to Flux for some of the data handling.

Was this solved ? Did they manage to handle all the data needs of their apps with GraphQL or is it still limited to certain areas ?

Post reply on HN