From 030208712a582297512f4bd609cc2087cb9f594f Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Thu, 22 Oct 2020 15:00:29 +1300 Subject: [PATCH] NEW GraphQL 4 Compatability (#72) * Initial compat for graphql4 * Fix graphql config --- _config/graphql-legacy.yml | 59 +++++++++++++++++++++++++++ _config/graphql.yml | 81 +++++++++++++++++++------------------- 2 files changed, 99 insertions(+), 41 deletions(-) create mode 100644 _config/graphql-legacy.yml diff --git a/_config/graphql-legacy.yml b/_config/graphql-legacy.yml new file mode 100644 index 0000000..1919f16 --- /dev/null +++ b/_config/graphql-legacy.yml @@ -0,0 +1,59 @@ +--- +Name: frameworktestgraphql-legacy +After: '#graphqlconfig' +Except: + classexists: 'SilverStripe\GraphQL\Schema\Schema' +--- + +SilverStripe\Core\Injector\Injector: + SilverStripe\GraphQL\Manager.frameworktest: + class: SilverStripe\GraphQL\Manager + constructor: + identifier: frameworktest + SilverStripe\GraphQL\Controller.frameworktest: + class: SilverStripe\GraphQL\Controller + constructor: + manager: '%$SilverStripe\GraphQL\Manager.frameworktest' + +SilverStripe\Control\Director: + rules: + 'frameworktest/graphql': + Controller: '%$SilverStripe\GraphQL\Controller.frameworktest' + +SilverStripe\GraphQL\Manager: + schemas: + frameworktest: + typeNames: + SilverStripe\FrameworkTest\Model\Company: Company + SilverStripe\FrameworkTest\Model\Employee: Employee + scaffolding: + types: + SilverStripe\FrameworkTest\Model\Company: + fields: + - ID + - Name + - Category + - Revenue + - CEO + operations: + read: true + update: true + create: true + delete: true + readOne: true + nestedQueries: + Employees: true + PastEmployees: true + SilverStripe\FrameworkTest\Model\Employee: + fields: + - ID + - Name + - Biography + - DateOfBirth + - Category + operations: + read: true + update: true + create: true + delete: true + readOne: true diff --git a/_config/graphql.yml b/_config/graphql.yml index 091c04c..9e42f03 100644 --- a/_config/graphql.yml +++ b/_config/graphql.yml @@ -1,59 +1,58 @@ --- Name: frameworktestgraphql After: '#graphqlconfig' +Only: + classexists: 'SilverStripe\GraphQL\Schema\Schema' --- SilverStripe\Core\Injector\Injector: - SilverStripe\GraphQL\Manager.frameworktest: - class: SilverStripe\GraphQL\Manager + SilverStripe\GraphQL\Schema\Schema.frameworktest: + class: SilverStripe\GraphQL\Schema\Schema constructor: - identifier: frameworktest + schemaKey: frameworktest SilverStripe\GraphQL\Controller.frameworktest: class: SilverStripe\GraphQL\Controller constructor: - manager: '%$SilverStripe\GraphQL\Manager.frameworktest' - - + schema: frameworktest SilverStripe\Control\Director: rules: 'frameworktest/graphql': Controller: '%$SilverStripe\GraphQL\Controller.frameworktest' -SilverStripe\GraphQL\Manager: +SilverStripe\GraphQL\Schema\Schema: schemas: frameworktest: - typeNames: - SilverStripe\FrameworkTest\Model\Company: Company - SilverStripe\FrameworkTest\Model\Employee: Employee - scaffolding: - types: - SilverStripe\FrameworkTest\Model\Company: - fields: - - ID - - Name - - Category - - Revenue - - CEO - operations: - read: true - update: true - create: true - delete: true - readOne: true - nestedQueries: - Employees: true - PastEmployees: true - SilverStripe\FrameworkTest\Model\Employee: - fields: - - ID - - Name - - Biography - - DateOfBirth - - Category - operations: - read: true - update: true - create: true - delete: true - readOne: true \ No newline at end of file + modelConfig: + type_mapping: + SilverStripe\FrameworkTest\Model\Company: Company + SilverStripe\FrameworkTest\Model\Employee: Employee + models: + SilverStripe\FrameworkTest\Model\Company: + fields: + ID: true + Name: true + Category: true + Revenue: true + CEO: true + Employees: true + PastEmployees: true + operations: + read: true + update: true + create: true + delete: true + readOne: true + SilverStripe\FrameworkTest\Model\Employee: + fields: + ID: true + Name: true + Biography: true + DateOfBirth: true + Category: true + operations: + read: true + update: true + create: true + delete: true + readOne: true