diff --git a/UPGRADE-0.10.md b/UPGRADE-0.10.md deleted file mode 100644 index 857d4305c..000000000 --- a/UPGRADE-0.10.md +++ /dev/null @@ -1,17 +0,0 @@ -UPGRADE FROM 0.9 to 0.10 -======================= - -# Table of Contents - -- [Symfony](#symfony) - -### Symfony - - * Minimal supported Symfony version is now `^3.1 || ^4.0` - - We've dropped support for Symfony 2.8 and 3.0 - - Upgrading your Symfony version: - - [Upgrading to Symfony 3.0](https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md) - - [Upgrading to Symfony 3.1](https://github.com/symfony/symfony/blob/master/UPGRADE-3.1.md) - diff --git a/UPGRADE-0.11.md b/UPGRADE-0.11.md deleted file mode 100644 index 5a6797406..000000000 --- a/UPGRADE-0.11.md +++ /dev/null @@ -1,276 +0,0 @@ -UPGRADE FROM 0.10 to 0.11 -======================= - -# Table of Contents - -- [GraphiQL](#graphiql) -- [Errors handler](#errors-handler) -- [Promise adapter interface](#promise-adapter-interface) -- [Expression language](#expression-language) -- [Type autoMapping and Symfony DI autoconfigure](#type-automapping-and-symfony-di-autoconfigure) -- [Events](#events) -- [Explicitly declare non detected types](#explicitly-declare-non-detected-types) -- [Change fluent resolvers id](#change-fluent-resolvers-id) - -### GraphiQL - - * The GraphiQL interface has been removed in favor of a new bundle. - - Upgrading: - - Remove the graphiql route from your application - - For standard Symfony installation: `/app/config/routing_dev.yml` - - For Symfony Flex: `/config/routes/dev/graphql_graphiql.yaml` - - Installing OverblogGraphiQLBundle - - `composer require --dev overblog/graphiql-bundle` - - Follow instructions at https://github.com/overblog/GraphiQLBundle - - In case you have defined the `versions` in your configuration - - Remove it from `overblog_graphql` - ```diff - overblog_graphql: - - versions: - - graphiql: "0.11" - - react: "15.6" - - fetch: "2.0" - - relay: "classic" - ``` - - Add it to `overblog_graphiql` - ```diff - overblog_graphiql: - + javascript_libraries: - + graphiql: "0.11" - + react: "15.6" - + fetch: "2.0" - ``` - - If you were using the `graphql:dump-schema` and depending on the `relay` - version as in the previous configuration, now you have to explicitly choose - for a format during the command: - ``` - bin/console graphql:dump-schema --modern - ``` - -### Errors Handler - - * Made errors handler more customizable - - Upgrading: - - Delete configuration to override base user exception classes. - ```diff - overblog_graphql: - definitions: - exceptions: - - types: - - warnings: ~ - - errors: ~ - ``` - - Move `internal_error_message`, `map_exceptions_to_parent` and `exceptions` configurations - from `definitions` to new dedicated `error_handler` section. - ```diff - overblog_graphql: - definitions: - - internal_error_message: ~ - - map_exceptions_to_parent: ~ - - exceptions: ~ - + errors_handler: - + internal_error_message: ~ - + map_exceptions_to_parent: ~ - + exceptions: ~ - ``` - - -### Promise adapter interface - - * Changed the promise adapter interface (`Overblog\GraphQLBundle\Executor\ExecutorInterface`) - as the promiseAdapter is not nullable in the bundle context. - - Upgrading: - - `setPromiseAdapter` method no more nullable. - ```diff - - public function setPromiseAdapter(PromiseAdapter $promiseAdapter = null); - + public function setPromiseAdapter(PromiseAdapter $promiseAdapter); - ``` - -### Expression language - - * **user** expression variable has been replaced by **getUser** expression function - * **container**, **request** and **token** expression variables has been removed. - `service` or `serv` expression function should be used instead. - - Upgrading your schema configuration: - - Replace `user` by `getUser()`: - ```diff - - resolve: '@=user' - + resolve: '@=getUser()' - ``` - - or - - ```diff - - resolve: '@=resolver('foo', [user])' - + resolve: '@=resolver('foo', [getUser()])' - ``` - - Replace `token` by `serv('security.token_storage')` - ```diff - - resolve: '@=token' - + resolve: '@=serv('security.token_storage')' - ``` - - or - - ```diff - - resolve: '@=resolver('foo', [token])' - + resolve: '@=resolver('foo', [serv('security.token_storage')])' - ``` - - Replace `request` by `serv('request_stack')` - ```diff - - resolve: '@=request' - + resolve: '@=serv('request_stack')' - ``` - - or - - ```diff - - resolve: '@=resolver('foo', [request])' - + resolve: '@=resolver('foo', [serv('request_stack')])' - ``` -### Type autoMapping and Symfony DI `autoconfigure` - - When using these functionality, type will be accessible only by FQCN in schema definition, - (if class not implementing `Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface`). - So if you want to use the `true` type name don't forget to declare it as an alias using interface. - This change is for a performance mater types are lazy loaded. - - example: - - ```php - rootValue` and - `$context === $value` in root query resolver. That for the reason why uploaded files was accessible in - `$context['request_files']` and `$info->rootValue['request_files']`. - - **Since 0.11** - `context` is of type `ArrayObject` and `rootValue` has no typeHint (default: `null`) so - `$context !== $info->rootValue` and `$context !== $value` in root query resolver. - Uploaded files is no more accessible under `$info->rootValue['request_files']` out of the box. - -### Change fluent resolvers id - - The use of class name as prefix of fluent resolver id remove the possibility to use same class as 2 different services. - See issue [#296](https://github.com/overblog/GraphQLBundle/issues/296) for more detail - That's the reason why starting v0.11 we are using service id as prefix (like in Symfony 4.1)... - - Example: - ```yaml - services: - app.resolver.greetings: - class: App\GraphQL\Resolver\Greetings - tags: - - { name: overblog_graphql.resolver, method: __invoke, alias: say_hello } - - { name: overblog_graphql.resolver } - ``` - - **Before 0.11**: `'@=resolver("App\\GraphQL\\Resolver\\Greetings", [args['name']])'` - - **Since 0.11**: `'@=resolver("app.resolver.greetings", [args['name']])'` diff --git a/UPGRADE-0.12.md b/UPGRADE-0.12.md deleted file mode 100644 index a22eb6ffd..000000000 --- a/UPGRADE-0.12.md +++ /dev/null @@ -1,116 +0,0 @@ -UPGRADE FROM 0.11 to 0.12 -======================= - -# Table of Contents - -- [Remove auto mapping configuration](#remove-auto-mapping-configuration) -- [Relay Paginator, Connections & Edges](#relay-paginator-connections--edges) -- [Remove obsoletes deprecations](#remove-obsoletes-deprecations) -- [Simplify executor interface](#simplify-executor-interface) - -### Remove auto mapping configuration - - * The AutoMapping configuration entry has been removed in favor of Symfony 4+ service configuration. - - Upgrading: - - Delete old configuration. - ```diff - overblog_graphql: - definitions: - - auto_mapping: ~ - ``` - - use Symfony 4+ service configuration to tag your types, resolvers or mutation. - ```yaml - # config/services.yaml - services: - _defaults: - autoconfigure: true - - App\GraphQL\: - resource: ../src/GraphQL - ``` - - -### Relay Paginator, Connections & Edges - -- Following the [paginator update](docs/helpers/relay-paginator.md) and the use of interfaces for Relay Connection & Edge, getters & setters must be use to manipulate Connection, Edge and PageInfo Properties - -Before : - -```php -$connection->edges = $edges; -$connection->totalCount = 10; -... -$edge->cursor = $cursor; -$edge->node = $node; - -``` - -After : - -```php -$connection->setEdges($edges); -$connection->setTotalCount(10); -... -$edge->setCursor($cursor); -$edge->setNode($node); -``` - -Connection builder has been moved and it methods are no more accessible statically: - -Before: - -```php -use Overblog\GraphQLBundle\Relay\Connection\Output\ConnectionBuilder; - -ConnectionBuilder::connectionFromArray([]); -``` - -After: - -```php -use Overblog\GraphQLBundle\Relay\Connection\ConnectionBuilder; - -$connectionBuilder = new ConnectionBuilder(); -$connectionBuilder->connectionFromArray([]); -``` - -### Remove obsoletes deprecations - -The builder short syntax (Field: Builder => Field: {builder: Builder}) is obsolete: - -```diff -Foo: - type: object - config: - fields: -- bar: MyBuilder -+ bar: {builder: MyBuilder} - -``` - -Relay builder without 'Relay::' prefix is obsolete: - -```diff -Foo: - type: object - config: - fields: - bar: -- argsBuilder: ConnectionArgs -+ argsBuilder: "Relay::Connection" -``` - -### Simplify executor interface - -This section is only for users using custom executor. - -The interface move to be look a little be more to `GraphQL\GraphQL` -`promiseToExecute` method. - -In `Overblog\GraphQLBundle\Executor\ExecutorInterface` -`setPromiseAdapter` and `setDefaultFieldResolver` has been removed. - -Promise adapter is now the first argument (`$promiseAdapter`) -and default field resolver the 7th argument (`$fieldResolver`) of -`Overblog\GraphQLBundle\Executor\ExecutorInterface::execute` method. diff --git a/UPGRADE-0.13.md b/UPGRADE-0.13.md deleted file mode 100644 index 98d9ebe8d..000000000 --- a/UPGRADE-0.13.md +++ /dev/null @@ -1,77 +0,0 @@ -UPGRADE FROM 0.12 to 0.13 -======================= - -# Table of Contents - -- [Rename default_field config](#rename-default_field-config) -- [Improve default field resolver](#improve-default-field-resolver) -- [Use service tags to register resolver maps](#use-service-tags-to-register-resolver-maps) - -### Rename default_field config - -```diff -overblog_graphql: - definitions: -- default_resolver: ~ -+ default_field_resolver: ~ -``` - -The new `default_field_resolver` config entry accepts callable service id. - -### Improve default field resolver - -Stop using internally `symfony/property-access` package -since it was a bottleneck to performance for large schema. - -Array access and camelize getter/isser are supported but hasser, -jQuery style (e.g. `last()`) and "can" property accessors -are no more supported out-of-the-box, -please implement a custom resolver if these accessors are needed. - -Globally: - -```yaml -overblog_graphql: - definitions: - default_field_resolver: 'App\GraphQL\CustomResolver' -``` - -[see default field resolver for more details](https://webonyx.github.io/graphql-php/data-fetching/#default-field-resolver) - -Per Type: - -```yaml -MyType: - type: object - config: - resolveField: 'App\GraphQL\MyTypeResolver::defaultFieldResolver' - fields: - name: {type: String} - email: {type: String} -``` - -[see default Field Resolver per type for more details](https://webonyx.github.io/graphql-php/data-fetching/#default-field-resolver-per-type) - -### Use service tags to register resolver maps - -The resolver maps used to be configured using the `overblog_graphql.definitions.schema.resolver_maps` -option. This has been deprecated in favour of using service tags to register them. - -```diff -# config/graphql.yaml -overblog_graphql: - definitions: - schema: - # ... -- resolver_maps: -- - 'App\GraphQL\MyResolverMap' -``` - -```diff -# services/graphql.yaml -services: -- App\GraphQL\MyResolverMap: ~ -+ App\GraphQL\MyResolverMap: -+ tags: -+ - { name: overblog_graphql.resolver_map, schema: default } -``` diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 000000000..7ce17789e --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,491 @@ +UPGRADE FROM 0.12 to 0.13 +======================= + +# Table of Contents + +- [Rename default_field config](#rename-default_field-config) +- [Improve default field resolver](#improve-default-field-resolver) +- [Use service tags to register resolver maps](#use-service-tags-to-register-resolver-maps) + +### Rename default_field config + +```diff +overblog_graphql: + definitions: +- default_resolver: ~ ++ default_field_resolver: ~ +``` + +The new `default_field_resolver` config entry accepts callable service id. + +### Improve default field resolver + +Stop using internally `symfony/property-access` package +since it was a bottleneck to performance for large schema. + +Array access and camelize getter/isser are supported but hasser, +jQuery style (e.g. `last()`) and "can" property accessors +are no more supported out-of-the-box, +please implement a custom resolver if these accessors are needed. + +Globally: + +```yaml +overblog_graphql: + definitions: + default_field_resolver: 'App\GraphQL\CustomResolver' +``` + +[see default field resolver for more details](https://webonyx.github.io/graphql-php/data-fetching/#default-field-resolver) + +Per Type: + +```yaml +MyType: + type: object + config: + resolveField: 'App\GraphQL\MyTypeResolver::defaultFieldResolver' + fields: + name: {type: String} + email: {type: String} +``` + +[see default Field Resolver per type for more details](https://webonyx.github.io/graphql-php/data-fetching/#default-field-resolver-per-type) + +### Use service tags to register resolver maps + +The resolver maps used to be configured using the `overblog_graphql.definitions.schema.resolver_maps` +option. This has been deprecated in favour of using service tags to register them. + +```diff +# config/graphql.yaml +overblog_graphql: + definitions: + schema: + # ... +- resolver_maps: +- - 'App\GraphQL\MyResolverMap' +``` + +```diff +# services/graphql.yaml +services: +- App\GraphQL\MyResolverMap: ~ ++ App\GraphQL\MyResolverMap: ++ tags: ++ - { name: overblog_graphql.resolver_map, schema: default } +``` + +UPGRADE FROM 0.11 to 0.12 +======================= + +# Table of Contents + +- [Remove auto mapping configuration](#remove-auto-mapping-configuration) +- [Relay Paginator, Connections & Edges](#relay-paginator-connections--edges) +- [Remove obsoletes deprecations](#remove-obsoletes-deprecations) +- [Simplify executor interface](#simplify-executor-interface) + +### Remove auto mapping configuration + +* The AutoMapping configuration entry has been removed in favor of Symfony 4+ service configuration. + +Upgrading: +- Delete old configuration. + ```diff + overblog_graphql: + definitions: + - auto_mapping: ~ + ``` +- use Symfony 4+ service configuration to tag your types, resolvers or mutation. + ```yaml + # config/services.yaml + services: + _defaults: + autoconfigure: true + + App\GraphQL\: + resource: ../src/GraphQL + ``` + + +### Relay Paginator, Connections & Edges + +- Following the [paginator update](docs/helpers/relay-paginator.md) and the use of interfaces for Relay Connection & Edge, getters & setters must be use to manipulate Connection, Edge and PageInfo Properties + +Before : + +```php +$connection->edges = $edges; +$connection->totalCount = 10; +... +$edge->cursor = $cursor; +$edge->node = $node; + +``` + +After : + +```php +$connection->setEdges($edges); +$connection->setTotalCount(10); +... +$edge->setCursor($cursor); +$edge->setNode($node); +``` + +Connection builder has been moved and it methods are no more accessible statically: + +Before: + +```php +use Overblog\GraphQLBundle\Relay\Connection\Output\ConnectionBuilder; + +ConnectionBuilder::connectionFromArray([]); +``` + +After: + +```php +use Overblog\GraphQLBundle\Relay\Connection\ConnectionBuilder; + +$connectionBuilder = new ConnectionBuilder(); +$connectionBuilder->connectionFromArray([]); +``` + +### Remove obsoletes deprecations + +The builder short syntax (Field: Builder => Field: {builder: Builder}) is obsolete: + +```diff +Foo: + type: object + config: + fields: +- bar: MyBuilder ++ bar: {builder: MyBuilder} + +``` + +Relay builder without 'Relay::' prefix is obsolete: + +```diff +Foo: + type: object + config: + fields: + bar: +- argsBuilder: ConnectionArgs ++ argsBuilder: "Relay::Connection" +``` + +### Simplify executor interface + +This section is only for users using custom executor. + +The interface move to be look a little be more to `GraphQL\GraphQL` +`promiseToExecute` method. + +In `Overblog\GraphQLBundle\Executor\ExecutorInterface` +`setPromiseAdapter` and `setDefaultFieldResolver` has been removed. + +Promise adapter is now the first argument (`$promiseAdapter`) +and default field resolver the 7th argument (`$fieldResolver`) of +`Overblog\GraphQLBundle\Executor\ExecutorInterface::execute` method. + + +UPGRADE FROM 0.10 to 0.11 +======================= + +# Table of Contents + +- [GraphiQL](#graphiql) +- [Errors handler](#errors-handler) +- [Promise adapter interface](#promise-adapter-interface) +- [Expression language](#expression-language) +- [Type autoMapping and Symfony DI autoconfigure](#type-automapping-and-symfony-di-autoconfigure) +- [Events](#events) +- [Explicitly declare non detected types](#explicitly-declare-non-detected-types) +- [Change fluent resolvers id](#change-fluent-resolvers-id) + +### GraphiQL + +* The GraphiQL interface has been removed in favor of a new bundle. + +Upgrading: +- Remove the graphiql route from your application + - For standard Symfony installation: `/app/config/routing_dev.yml` + - For Symfony Flex: `/config/routes/dev/graphql_graphiql.yaml` +- Installing OverblogGraphiQLBundle + - `composer require --dev overblog/graphiql-bundle` + - Follow instructions at https://github.com/overblog/GraphiQLBundle +- In case you have defined the `versions` in your configuration + - Remove it from `overblog_graphql` + ```diff + overblog_graphql: + - versions: + - graphiql: "0.11" + - react: "15.6" + - fetch: "2.0" + - relay: "classic" + ``` + - Add it to `overblog_graphiql` + ```diff + overblog_graphiql: + + javascript_libraries: + + graphiql: "0.11" + + react: "15.6" + + fetch: "2.0" + ``` + - If you were using the `graphql:dump-schema` and depending on the `relay` + version as in the previous configuration, now you have to explicitly choose + for a format during the command: + ``` + bin/console graphql:dump-schema --modern + ``` + +### Errors Handler + +* Made errors handler more customizable + +Upgrading: +- Delete configuration to override base user exception classes. + ```diff + overblog_graphql: + definitions: + exceptions: + - types: + - warnings: ~ + - errors: ~ + ``` +- Move `internal_error_message`, `map_exceptions_to_parent` and `exceptions` configurations + from `definitions` to new dedicated `error_handler` section. + ```diff + overblog_graphql: + definitions: + - internal_error_message: ~ + - map_exceptions_to_parent: ~ + - exceptions: ~ + + errors_handler: + + internal_error_message: ~ + + map_exceptions_to_parent: ~ + + exceptions: ~ + ``` + + +### Promise adapter interface + +* Changed the promise adapter interface (`Overblog\GraphQLBundle\Executor\ExecutorInterface`) + as the promiseAdapter is not nullable in the bundle context. + +Upgrading: +- `setPromiseAdapter` method no more nullable. + ```diff + - public function setPromiseAdapter(PromiseAdapter $promiseAdapter = null); + + public function setPromiseAdapter(PromiseAdapter $promiseAdapter); + ``` + +### Expression language + +* **user** expression variable has been replaced by **getUser** expression function +* **container**, **request** and **token** expression variables has been removed. + `service` or `serv` expression function should be used instead. + +Upgrading your schema configuration: +- Replace `user` by `getUser()`: + ```diff + - resolve: '@=user' + + resolve: '@=getUser()' + ``` + + or + + ```diff + - resolve: '@=resolver('foo', [user])' + + resolve: '@=resolver('foo', [getUser()])' + ``` +- Replace `token` by `serv('security.token_storage')` + ```diff + - resolve: '@=token' + + resolve: '@=serv('security.token_storage')' + ``` + + or + + ```diff + - resolve: '@=resolver('foo', [token])' + + resolve: '@=resolver('foo', [serv('security.token_storage')])' + ``` +- Replace `request` by `serv('request_stack')` + ```diff + - resolve: '@=request' + + resolve: '@=serv('request_stack')' + ``` + + or + + ```diff + - resolve: '@=resolver('foo', [request])' + + resolve: '@=resolver('foo', [serv('request_stack')])' + ``` +### Type autoMapping and Symfony DI `autoconfigure` + +When using these functionality, type will be accessible only by FQCN in schema definition, +(if class not implementing `Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface`). +So if you want to use the `true` type name don't forget to declare it as an alias using interface. +This change is for a performance mater types are lazy loaded. + +example: + + ```php + rootValue` and +`$context === $value` in root query resolver. That for the reason why uploaded files was accessible in +`$context['request_files']` and `$info->rootValue['request_files']`. + +**Since 0.11** +`context` is of type `ArrayObject` and `rootValue` has no typeHint (default: `null`) so +`$context !== $info->rootValue` and `$context !== $value` in root query resolver. +Uploaded files is no more accessible under `$info->rootValue['request_files']` out of the box. + +### Change fluent resolvers id + +The use of class name as prefix of fluent resolver id remove the possibility to use same class as 2 different services. +See issue [#296](https://github.com/overblog/GraphQLBundle/issues/296) for more detail +That's the reason why starting v0.11 we are using service id as prefix (like in Symfony 4.1)... + +Example: + ```yaml + services: + app.resolver.greetings: + class: App\GraphQL\Resolver\Greetings + tags: + - { name: overblog_graphql.resolver, method: __invoke, alias: say_hello } + - { name: overblog_graphql.resolver } + ``` + +**Before 0.11**: `'@=resolver("App\\GraphQL\\Resolver\\Greetings", [args['name']])'` + +**Since 0.11**: `'@=resolver("app.resolver.greetings", [args['name']])'` + + +UPGRADE FROM 0.9 to 0.10 +======================= + +# Table of Contents + +- [Symfony](#symfony) + +### Symfony + +* Minimal supported Symfony version is now `^3.1 || ^4.0` + + We've dropped support for Symfony 2.8 and 3.0 + +Upgrading your Symfony version: +- [Upgrading to Symfony 3.0](https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md) +- [Upgrading to Symfony 3.1](https://github.com/symfony/symfony/blob/master/UPGRADE-3.1.md) +