Skip to content

Instantly share code, notes, and snippets.

@maxime-rainville
Last active April 19, 2025 09:37
Show Gist options
  • Save maxime-rainville/de1c1ef5d716551f0eb93b135c4c7105 to your computer and use it in GitHub Desktop.
Save maxime-rainville/de1c1ef5d716551f0eb93b135c4c7105 to your computer and use it in GitHub Desktop.
Very simple Sliverstripe GraphQL schema set up (assumes you have installed silverstripe/frameworktest)
# app/_graphql/models/company.yml
SilverStripe\FrameworkTest\Model\Company:
fields: '*'
operations:
'*': true
# app/_config/graphql.yml
---
Name: app-graphql
After: '#graphql'
---
SilverStripe\GraphQL\Schema\Schema:
schemas:
default:
src:
- app/_graphql
SilverStripe\Core\Injector\Injector:
SilverStripe\GraphQL\Schema\Schema.default:
class: SilverStripe\GraphQL\Schema\Schema
constructor:
schemaKey: default
SilverStripe\GraphQL\Controller.default:
class: SilverStripe\GraphQL\Controller
constructor:
schema: default
handler: '%$SilverStripe\GraphQL\QueryHandler\QueryHandlerInterface.default'
SilverStripe\GraphQL\QueryHandler\QueryHandlerInterface.default:
class: SilverStripe\GraphQL\QueryHandler\QueryHandler
properties:
Middlewares:
httpMethod: '%$SilverStripe\GraphQL\Middleware\HTTPMethodMiddleware'
SilverStripe\Control\Director:
rules:
'graphql':
Controller: '%$SilverStripe\GraphQL\Controller.default'
# Add a description to the Company
SilverStripe\FrameworkTest\Model\Company:
class_description: Companies are big businesses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment