Open jamesroseman opened 8 years ago
I see now what's going on. I think the functionality I'm looking for is defined as feed
rather than something like article
without ID
argument, or even articles
. I understand this whole project is a mock to demonstrate how easily the GraphQL plug works, but for newbies it's difficult to understand why there's no supported functionality for a general article
query that returns all articles.
In simple_blog_schema.ex
:
%Schema{query: blog_query}
...where a blog_query is:
blog_query = %ObjectType{
name: "Query",
fields: %{
article: %{
type: article,
args: %{id: %{type: %ID{}}},
resolve: fn(_, %{id: id}, _) -> make_article(id) end
},
feed: %{
type: %List{ofType: article},
resolve: fn(_, _, _) -> for id <- 1..2, do: make_article(id) end
}
}
}
http://localhost:4000/graphql/blog?query=%7B%0A%09article%20%7B%0A%09%20%20id%0A%09%7D%0A%7D
Hitting this endpoint results in this error message on iQL:
And this error message in console:
I'm unsure if
article
querying is allowed across all objects (rather than just byid
), and it's broken, or that's just strictly not allowed behavior. I'm new to Phoenix/Elixir, so I'm not positive -- reporting just to be sure you're aware.