blueo

I just have a test project set up and I found this:

  • just setting the director rule (route) is not enough - it gives the same error
  • as soon as I added a type to the scheme eg
    1. SilverStripe\GraphQL\Manager:
    2. schemas:
    3. default:
    4. scaffolding:
    5. types:
    6. Page:
    7. fields: [ID, Title, Content]
    8. operations:
    9. read: true
    10. create: true

    it works... so maybe the schema can't be empty?

chillu

Any takers? https://forum.silverstripe.org/t/issue-getting-graphql-to-work/1740

Show 1 attachment(s)
Silverstripe Forum  
Issue getting GraphQL to work

Silverstripe Version: 4.3 Question: I have setup GraphQL with an empty config and as far as I can tell I should be getting a result for the query: /graphql/?query={__schema{types{kind+name+description}}} I have set up the route with SilverStripe\Control\Director: rules: 'graphql': '%$SilverStripe\GraphQL\Controller.default' but all I get back is an error - “Schema query must be Object Type but got: NULL” The route /admin/graphql is working and gives me the expected result I have o...

Hide attachment content
blueo

I think (haven't done this for a while) you need to activate the default schema eg from the usage section:

  1. By default, this module does not route any GraphQL servers. To activate the default, public-facing GraphQL server that ships with the module, just add a rule to Director.
  2.  
  3. SilverStripe\Control\Director:
  4. rules:
  5. 'graphql': '%$SilverStripe\GraphQL\Controller.default'
Pete

The same query works fine on /admin/graphql

Pete

But all I get is an error "Schema query must be Object Type but got: NULL"

Pete

Hi, I'm trying Silverstripe GraphQL for the first time and having a bit of trouble getting started. If I'm assuming correctly, I should be able to run the following query on an empty setup and get a result: /graphql/?query={__schema{types{kind+name+description}}}