graphql / swapi-graphql

A GraphQL schema and server wrapping SWAPI.
http://graphql.org/swapi-graphql/
MIT License
1.04k stars 275 forks source link

graphql SWAPI Reference #74

Closed andrewjtech123 closed 7 years ago

andrewjtech123 commented 7 years ago

I was just curious why the sample queries from here http://graphql.org/learn/ don't work on your graphiQL instance.

for example, if I run

{
  hero {
    name
  }
}

I get "Cannot query field \"hero\" on type \"Root\". Did you mean \"person\"?",

andrewjtech123 commented 7 years ago

That tutorial seems to be using completely different root types. Do you know if that tutorial has a GraphiQL associated with it ? seems like it should maybe align with what your doing in this repo though, unless I'm missing something

wincent commented 7 years ago

Thanks for bringing this up @andrewjtech123. If I understand correctly, it's not that the SWAPI schema and the tutorial schema diverged over time, but rather, the tutorial is based on a a much smaller hand-rolled schema (basically, this one) which was put together to test the reference implementation. They both happen to refer to the Star Wars universe, which has no doubt added to the confusion here.

I suspect we can probably fix this with a documentation update.

wincent commented 7 years ago

Closing this due to inactivity, but we'd still welcome any PRs that improve the documentation.

andrewjtech123 commented 7 years ago

I should have some time to have a looky into this if you like. I will see about opening a PR. Cheers :)

ml242 commented 7 years ago

It is also worth seeing the live implementation here: https://api.graphcms.com/simple/v1/swapi

where you can run a query like so:

{Planet( name: "Tatooine"){ population terrain residents(orderBy: birthYear_DESC){ name height hairColor birthYear } }

I am not sure if it would be possible to plug in the schema that graphCMS is using but I was able to grab the entire thing by using this library:

npm install -g get-graphql-schema

Sorry, I was getting my star wars api's confused here.