Releases: rebing/graphql-laravel
8.2.1
8.2.0
Fixed
- Fix "No configuration for schema '' found" when route prefix is empty string \888 / hello-liang-shan
8.1.0
Added
- Support for Laravel 9 #879 / mfn
8.0.0 🎉
After quite some RC cycles, the next major release finally arrived!
Note: this new release contains a LOT of BREAKING CHANGES, please make sure to review the change changelog and test before you deploy!
High level changes:
- routing has been rewritten/simplified
- processing of GraphQL requests has been unified to better accommodate for optional features like Automatic Persisted Queries (APQ)
- lots-o-breaking changes and clean ups
- Support for Lumen has been removed
Please find all the details below:
Breaking changes
-
Rewrite and simplify how schemas are handled
\Rebing\GraphQL\GraphQL::$schemasnow only holdsSchemas and not a
mixture of strings or arrays\Rebing\GraphQL\GraphQL::schema()now only accepts a "schema name", but no
ad hocSchemaor "schema configs". To use ad hoc schemas, use
\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()and
\Rebing\GraphQL\GraphQL::addSchema()\Rebing\GraphQL\GraphQL::queryAndReturnResult()(and thus also
\Rebing\GraphQL\GraphQL::query()) does not accept ad hoc schemas via
$opts['schema']anymore; it now only can reference a schema via its name.\Rebing\GraphQL\GraphQL::addSchema()now only acceptSchemaobjects,
where before it would support ad hoc schemas via array configuration.
Use\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()for that now.\Rebing\GraphQL\GraphQL::getSchemaConfiguration()has been removed due to
the simplifications.\Rebing\GraphQL\GraphQL::getNormalizedSchemaConfiguration()does not
support ad hoc schemas anymore and only accepts the schema name.\Rebing\GraphQL\GraphQLServiceProvider::bootSchemas()has been removed due
to the simplifications.
-
The following methods now take a
\Illuminate\Contracts\Config\Repositoryas
second argument:\Rebing\GraphQL\GraphQL::__construct\Rebing\GraphQL\GraphQLServiceProvider::applySecurityRules
-
As part of moving the architecture to an execution based middleware approach,
the following methods have been removed:\Rebing\GraphQL\GraphQLController::handleAutomaticPersistQuerieshas been
replaced by theAutomaticPersistedQueriesMiddlewaremiddleware\Rebing\GraphQL\GraphQLController::queryContexthas been
replaced by theAddAuthUserContextValueMiddlewaremiddleware
If you relied on overridingqueryContextto inject a custom context, you
now need to create your own execution middleware and add to your
configuration\Rebing\GraphQL\GraphQLController::executeQueryhas become obsolete, no
direct replacement.
-
Routing has been rewritten and simplified #757 / mfn
- All routing related configuration is now within the top level
route
configuration key - The following configuration options have been removed:
graphql.routes
It's therefore also not possible anymore to register different routes for
queries and mutations within a schema. Each schema gets only one route
(except for the default schema, which is registered for the global prefix
route as well as under its name).
If necessary, this can be emulated with different schemas and multi-level
paths
- The following configuration options have been moved/renamed:
graphql.prefix=>graphql.route.prefixgraphql.controllers=>graphql.route.controller
Further, providing a controller action forqueryormutationis not
supported anymore.graphql.middleware=>graphql.route.middlewaregraphql.route_group_attributes=>graphql.route.group_attributes
- The actual routes defined have changed:
- No more separate routes for the HTTP methods
- 1 route for each schema + 1 route for the group prefix (default schema)
- If GraphiQL is enabled: 1 route graphiql route for each schema + 1 for the
graphiql group prefix (default schema) - If provided, the
'method'argument must provide the HTTP method
verbs in uppercase likePOSTorGET,postorgetwill not work.
- It's now possible to prevent the registering of any routes by making the top
levelroutean empty array or null \Rebing\GraphQL\GraphQL::routeNameTransformerhas been removed- It's now possible to register schemas with a
-in their name - Routes are now properly cacheable
- All routing related configuration is now within the top level
-
Remove the
\Rebing\GraphQL\GraphQLController::$appproperty #755 / mfn
Injecting the application container early is incompatible when running within
an application server like laravel/octane, as it's not guaranteed that the
container received contains all the bindings. If you relied on this property
when extending the classes, invoke the container directly via
Container::getInstance(). -
Remove deprecated
\Rebing\GraphQL\Support\Type::$inputObjectand\Rebing\GraphQL\Support\Type::$enumObjectproperties #752 / mfn
Instead in your code, extend\Rebing\GraphQL\Support\InputTypeand\Rebing\GraphQL\Support\EnumTypedirectly -
Support for Lumen has been removed
-
Integrate laragraph/utils RequestParser #739 / mfn
The parsing of GraphQL requests is now more strict:- if you send a
GETrequest, the GraphQL query has to be in the query parameters - if you send a
POSTrequest, the GraphQL query needs to be in the body
Mixing of either isn't possible anymore - batched queries will only work with
POSTrequests
This is due toRequestParserusing\GraphQL\Server\Helper::parseRequestParamswhich includes this check
Further: - Drop support for configuration the name of the variable for the variables (
params_key) GraphQLUploadMiddlewarehas been removed (RequestParserincludes this functionality)- Empty GraphQL queries now return a proper validated GraphQL error
- if you send a
-
In
\Rebing\GraphQL\GraphQL, renamed remaining instances of$paramsto$variables
After switching toRequestParser, the support for changing the variable name
what was supposed toparams_keyhas gone and thus the name isn't fitting anymore.
Also, the default value for$variableshas been changed tonullto better
fit the howOperationParamsworks:-
old:
public function query(string $query, ?array $params = [], array $opts = []): array
new:public function query(string $query, ?array $variables = null, array $opts = []): array -
old:
public function queryAndReturnResult(string $query, ?array $params = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult(string $query, ?array $variables = null, array $opts = []): ExecutionResult -
\Rebing\GraphQL\Support\ResolveInfoFieldsAndArgumentshas been removed -
$getSelectFieldsclosure no longer takes a depth parameter
-
-
The
$argsargument, of thehandlemethod of the execution middlewares requiresarrayas type.
Added
- Command to make an execution middleware #772 / mfn
- Command to make a schema configuration #830 / matsn0w
- The primary execution of the GraphQL request is now piped through middlewares #762 / crissi and mfn
This allows greater flexibility for enabling/disabling certain functionality
as well as bringing in new features without having to open up the library. - Primarily register \Rebing\GraphQL\GraphQL as service and keep
'graphql'as alias #768 / mfn - Automatic Persisted Queries (APQ) now cache the parsed query #740 / mfn
This avoids having to re-parse the same queries over and over again. - Add ability to detect unused GraphQL variables #660 / mfn
- Laravel's
ValidationExceptionis now formatted the same way as aValidationError#748 / mfn - A few missing typehints (mostly array related) #849 / mfn
Changed
- Internally webonyx query plan feature is now used for retrieving information about a query #793 / crissi)
- Rewrite and simplify how schemas are handled #779 / mfn
- Internally stop using the global
config()function and preferable use the repository or the Facade otherwise #774 / mfn - Don't silence broken schemas when normalizing them for generating routes #766 / mfn
- Lazy loading types has been enabled by default #758 / mfn
- Make it easier to extend select fields #799 / crissi
- The
$argsargument, of thehandlemethod of the execution middlewares requiresarrayas type #843 / sforward - Embrace thecodingmachine/safe and use thecodingmachine/phpstan-safe-rule to enforce it #851 / mfn
- Don't require a return value for the query option of fields #856 / sforward
Fixed
- Fix
TypeNotFoundwhen an interf...
8.0.0-rc6 / "one more RC release…"
Changes since the last RC
- A few missing typehints (mostly array related) #849 / mfn
- Embrace thecodingmachine/safe and use thecodingmachine/phpstan-safe-rule to enforce it #851 / mfn
Full ChangeLog since 7.2.0
Breaking changes
-
Rewrite and simplify how schemas are handled
\Rebing\GraphQL\GraphQL::$schemasnow only holdsSchemas and not a
mixture of strings or arrays\Rebing\GraphQL\GraphQL::schema()now only accepts a "schema name", but no
ad hocSchemaor "schema configs". To use ad hoc schemas, use
\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()and
\Rebing\GraphQL\GraphQL::addSchema()\Rebing\GraphQL\GraphQL::queryAndReturnResult()(and thus also
\Rebing\GraphQL\GraphQL::query()) does not accept ad hoc schemas via
$opts['schema']anymore; it now only can reference a schema via its name.\Rebing\GraphQL\GraphQL::addSchema()now only acceptSchemaobjects,
where before it would support ad hoc schemas via array configuration.
Use\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()for that now.\Rebing\GraphQL\GraphQL::getSchemaConfiguration()has been removed due to
the simplifications.\Rebing\GraphQL\GraphQL::getNormalizedSchemaConfiguration()does not
support ad hoc schemas anymore and only accepts the schema name.\Rebing\GraphQL\GraphQLServiceProvider::bootSchemas()has been removed due
to the simplifications.
-
The following methods now take a
\Illuminate\Contracts\Config\Repositoryas
second argument:\Rebing\GraphQL\GraphQL::__construct\Rebing\GraphQL\GraphQLServiceProvider::applySecurityRules
-
As part of moving the architecture to an execution based middleware approach,
the following methods have been removed:\Rebing\GraphQL\GraphQLController::handleAutomaticPersistQuerieshas been
replaced by theAutomaticPersistedQueriesMiddlewaremiddleware\Rebing\GraphQL\GraphQLController::queryContexthas been
replaced by theAddAuthUserContextValueMiddlewaremiddleware
If you relied on overridingqueryContextto inject a custom context, you
now need to create your own execution middleware and add to your
configuration\Rebing\GraphQL\GraphQLController::executeQueryhas become obsolete, no
direct replacement.
-
Routing has been rewritten and simplified #757 / mfn
- All routing related configuration is now within the top level
route
configuration key - The following configuration options have been removed:
graphql.routes
It's therefore also not possible anymore to register different routes for
queries and mutations within a schema. Each schema gets only one route
(except for the default schema, which is registered for the global prefix
route as well as under its name).
If necessary, this can be emulated with different schemas and multi-level
paths
- The following configuration options have been moved/renamed:
graphql.prefix=>graphql.route.prefixgraphql.controllers=>graphql.route.controller
Further, providing a controller action forqueryormutationis not
supported anymore.graphql.middleware=>graphql.route.middlewaregraphql.route_group_attributes=>graphql.route.group_attributes
- The actual routes defined have changed:
- No more separate routes for the HTTP methods
- 1 route for each schema + 1 route for the group prefix (default schema)
- If GraphiQL is enabled: 1 route graphiql route for each schema + 1 for the
graphiql group prefix (default schema) - If provided, the
'method'argument must provide the HTTP method
verbs in uppercase likePOSTorGET,postorgetwill not work.
- It's now possible to prevent the registering of any routes by making the top
levelroutean empty array or null \Rebing\GraphQL\GraphQL::routeNameTransformerhas been removed- It's now possible to register schemas with a
-in their name - Routes are now properly cacheable
- All routing related configuration is now within the top level
-
Remove the
\Rebing\GraphQL\GraphQLController::$appproperty #755 / mfn
Injecting the application container early is incompatible when running within
an application server like laravel/octane, as it's not guaranteed that the
container received contains all the bindings. If you relied on this property
when extending the classes, invoke the container directly via
Container::getInstance(). -
Remove deprecated
\Rebing\GraphQL\Support\Type::$inputObjectand\Rebing\GraphQL\Support\Type::$enumObjectproperties #752 / mfn
Instead in your code, extend\Rebing\GraphQL\Support\InputTypeand\Rebing\GraphQL\Support\EnumTypedirectly -
Support for Lumen has been removed
-
Integrate laragraph/utils RequestParser #739 / mfn
The parsing of GraphQL requests is now more strict:- if you send a
GETrequest, the GraphQL query has to be in the query parameters - if you send a
POSTrequest, the GraphQL query needs to be in the body
Mixing of either isn't possible anymore - batched queries will only work with
POSTrequests
This is due toRequestParserusing\GraphQL\Server\Helper::parseRequestParamswhich includes this check
Further: - Drop support for configuration the name of the variable for the variables (
params_key) GraphQLUploadMiddlewarehas been removed (RequestParserincludes this functionality)- Empty GraphQL queries now return a proper validated GraphQL error
- if you send a
-
In
\Rebing\GraphQL\GraphQL, renamed remaining instances of$paramsto$variables
After switching toRequestParser, the support for changing the variable name
what was supposed toparams_keyhas gone and thus the name isn't fitting anymore.
Also, the default value for$variableshas been changed tonullto better
fit the howOperationParamsworks:-
old:
public function query(string $query, ?array $params = [], array $opts = []): array
new:public function query(string $query, ?array $variables = null, array $opts = []): array -
old:
public function queryAndReturnResult(string $query, ?array $params = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult(string $query, ?array $variables = null, array $opts = []): ExecutionResult -
\Rebing\GraphQL\Support\ResolveInfoFieldsAndArgumentshas been removed -
$getSelectFieldsclosure no longer takes a depth parameter
-
-
The
$argsargument, of thehandlemethod of the execution middlewares requiresarrayas type.
Added
- Command to make an execution middleware #772 / mfn
- Command to make a schema configuration #830 / matsn0w
- The primary execution of the GraphQL request is now piped through middlewares #762 / crissi and mfn
This allows greater flexibility for enabling/disabling certain functionality
as well as bringing in new features without having to open up the library. - Primarily register \Rebing\GraphQL\GraphQL as service and keep
'graphql'as alias #768 / mfn - Automatic Persisted Queries (APQ) now cache the parsed query #740 / mfn
This avoids having to re-parse the same queries over and over again. - Add ability to detect unused GraphQL variables #660 / mfn
- Laravel's
ValidationExceptionis now formatted the same way as aValidationError#748 / mfn - A few missing typehints (mostly array related) #849 / mfn
Changed
- Internally webonyx query plan feature is now used for retrieving information about a query #793 / crissi)
- Rewrite and simplify how schemas are handled #779 / mfn
- Internally stop using the global
config()function and preferable use the repository or the Facade otherwise #774 / mfn - Don't silence broken schemas when normalizing them for generating routes #766 / mfn
- Lazy loading types has been enabled by default #758 / mfn
- Make it easier to extend select fields #799 / crissi
- The
$argsargument, of thehandlemethod of the execution middlewares requiresarrayas type #843 / sforward - Embrace thecodingmachine/safe and use thecodingmachine/phpstan-safe-rule to enforce it #851 / mfn
Fixed
- Fix
TypeNotFoundwhen an interface defined after another type where it is used #828 / kasian-sergeev
Removed
- The method
\Rebing\GraphQL\GraphQLServiceProvider::provideswas removed #769 / mfn
It's only relevant for deferred providers which ours howeve...
8.0.0-rc5 / final RC before release 🤞
Changes since the last RC
- The
$argsargument, of thehandlemethod of the execution middlewares requiresarrayas type #843 / sforward - Command to make a schema configuration #830 / matsn0w
- Make it easier to extend select fields #799 / crissi
- Fix
TypeNotFoundwhen an interface defined after another type where it is used #828 / kasian-sergeev
Full ChangeLog since 7.2.0
Breaking changes
-
Rewrite and simplify how schemas are handled
\Rebing\GraphQL\GraphQL::$schemasnow only holdsSchemas and not a
mixture of strings or arrays\Rebing\GraphQL\GraphQL::schema()now only accepts a "schema name", but no
ad hocSchemaor "schema configs". To use ad hoc schemas, use
\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()and
\Rebing\GraphQL\GraphQL::addSchema()\Rebing\GraphQL\GraphQL::queryAndReturnResult()(and thus also
\Rebing\GraphQL\GraphQL::query()) does not accept ad hoc schemas via
$opts['schema']anymore; it now only can reference a schema via its name.\Rebing\GraphQL\GraphQL::addSchema()now only acceptSchemaobjects,
where before it would support ad hoc schemas via array configuration.
Use\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()for that now.\Rebing\GraphQL\GraphQL::getSchemaConfiguration()has been removed due to
the simplifications.\Rebing\GraphQL\GraphQL::getNormalizedSchemaConfiguration()does not
support ad hoc schemas anymore and only accepts the schema name.\Rebing\GraphQL\GraphQLServiceProvider::bootSchemas()has been removed due
to the simplifications.
-
The following methods now take a
\Illuminate\Contracts\Config\Repositoryas
second argument:\Rebing\GraphQL\GraphQL::__construct\Rebing\GraphQL\GraphQLServiceProvider::applySecurityRules
-
As part of moving the architecture to an execution based middleware approach,
the following methods have been removed:\Rebing\GraphQL\GraphQLController::handleAutomaticPersistQuerieshas been
replaced by theAutomaticPersistedQueriesMiddlewaremiddleware\Rebing\GraphQL\GraphQLController::queryContexthas been
replaced by theAddAuthUserContextValueMiddlewaremiddleware
If you relied on overridingqueryContextto inject a custom context, you
now need to create your own execution middleware and add to your
configuration\Rebing\GraphQL\GraphQLController::executeQueryhas become obsolete, no
direct replacement.
-
Routing has been rewritten and simplified #757 / mfn
- All routing related configuration is now within the top level
route
configuration key - The following configuration options have been removed:
graphql.routes
It's therefore also not possible anymore to register different routes for
queries and mutations within a schema. Each schema gets only one route
(except for the default schema, which is registered for the global prefix
route as well as under its name).
If necessary, this can be emulated with different schemas and multi-level
paths
- The following configuration options have been moved/renamed:
graphql.prefix=>graphql.route.prefixgraphql.controllers=>graphql.route.controller
Further, providing a controller action forqueryormutationis not
supported anymore.graphql.middleware=>graphql.route.middlewaregraphql.route_group_attributes=>graphql.route.group_attributes
- The actual routes defined have changed:
- No more separate routes for the HTTP methods
- 1 route for each schema + 1 route for the group prefix (default schema)
- If GraphiQL is enabled: 1 route graphiql route for each schema + 1 for the
graphiql group prefix (default schema) - If provided, the
'method'argument must provide the HTTP method
verbs in uppercase likePOSTorGET,postorgetwill not work.
- It's now possible to prevent the registering of any routes by making the top
levelroutean empty array or null \Rebing\GraphQL\GraphQL::routeNameTransformerhas been removed- It's now possible to register schemas with a
-in their name - Routes are now properly cacheable
- All routing related configuration is now within the top level
-
Remove the
\Rebing\GraphQL\GraphQLController::$appproperty #755 / mfn
Injecting the application container early is incompatible when running within
an application server like laravel/octane, as it's not guaranteed that the
container received contains all the bindings. If you relied on this property
when extending the classes, invoke the container directly via
Container::getInstance(). -
Remove deprecated
\Rebing\GraphQL\Support\Type::$inputObjectand\Rebing\GraphQL\Support\Type::$enumObjectproperties #752 / mfn
Instead in your code, extend\Rebing\GraphQL\Support\InputTypeand\Rebing\GraphQL\Support\EnumTypedirectly -
Support for Lumen has been removed
-
Integrate laragraph/utils RequestParser #739 / mfn
The parsing of GraphQL requests is now more strict:- if you send a
GETrequest, the GraphQL query has to be in the query parameters - if you send a
POSTrequest, the GraphQL query needs to be in the body
Mixing of either isn't possible anymore - batched queries will only work with
POSTrequests
This is due toRequestParserusing\GraphQL\Server\Helper::parseRequestParamswhich includes this check
Further: - Drop support for configuration the name of the variable for the variables (
params_key) GraphQLUploadMiddlewarehas been removed (RequestParserincludes this functionality)- Empty GraphQL queries now return a proper validated GraphQL error
- if you send a
-
In
\Rebing\GraphQL\GraphQL, renamed remaining instances of$paramsto$variables
After switching toRequestParser, the support for changing the variable name
what was supposed toparams_keyhas gone and thus the name isn't fitting anymore.
Also, the default value for$variableshas been changed tonullto better
fit the howOperationParamsworks:-
old:
public function query(string $query, ?array $params = [], array $opts = []): array
new:public function query(string $query, ?array $variables = null, array $opts = []): array -
old:
public function queryAndReturnResult(string $query, ?array $params = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult(string $query, ?array $variables = null, array $opts = []): ExecutionResult -
\Rebing\GraphQL\Support\ResolveInfoFieldsAndArgumentshas been removed -
$getSelectFieldsclosure no longer takes a depth parameter
-
-
The
$argsargument, of thehandlemethod of the execution middlewares requiresarrayas type.
Added
- Command to make an execution middleware #772 / mfn
- Command to make a schema configuration #830 / matsn0w
- The primary execution of the GraphQL request is now piped through middlewares #762 / crissi and mfn
This allows greater flexibility for enabling/disabling certain functionality
as well as bringing in new features without having to open up the library. - Primarily register \Rebing\GraphQL\GraphQL as service and keep
'graphql'as alias #768 / mfn - Automatic Persisted Queries (APQ) now cache the parsed query #740 / mfn
This avoids having to re-parse the same queries over and over again. - Add ability to detect unused GraphQL variables #660 / mfn
- Laravel's
ValidationExceptionis now formatted the same way as aValidationError#748 / mfn
Changed
- Internally webonyx query plan feature is now used for retrieving information about a query #793 / crissi)
- Rewrite and simplify how schemas are handled #779 / mfn
- Internally stop using the global
config()function and preferable use the repository or the Facade otherwise #774 / mfn - Don't silence broken schemas when normalizing them for generating routes #766 / mfn
- Lazy loading types has been enabled by default #758 / mfn
- Make it easier to extend select fields #799 / crissi
- The
$argsargument, of thehandlemethod of the execution middlewares requiresarrayas type #843 / sforward
Fixed
- Fix
TypeNotFoundwhen an interface defined after another type where it is used #828 / kasian-sergeev
Removed
- The method
\Rebing\GraphQL\GraphQLServiceProvider::provideswas removed #769 / mfn
It's only relevant for deferred providers w...
8.0.0-rc4 / bring back configuring supported HTTP methods
Changes since the last RC
- The configuration of the
methodon theschemahas been brought back!
Unfortunately with a twist: HTTP methods provided must be all UPPERCASE
This is basically no change for the 7 -> 8 transition, but it was removed inthe initial rewrite of the routing and now brought back. Main reason is the ability to disable GraphQL for GET requests, if not desired (i.e. to prevent CSRF attacks) \Rebing\GraphQL\Support\ResolveInfoFieldsAndArgumentshas been removed$getSelectFieldsclosure no longer takes a depth parameter- Internally webonyx query plan feature is now used for retrieving information about a query #793 / crissi)
Full ChangeLog since 7.2.0
Breaking changes
-
Rewrite and simplify how schemas are handled
\Rebing\GraphQL\GraphQL::$schemasnow only holdsSchemas and not a
mixture of strings or arrays\Rebing\GraphQL\GraphQL::schema()now only accepts a "schema name", but no
ad hocSchemaor "schema configs". To use ad hoc schemas, use
\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()and
\Rebing\GraphQL\GraphQL::addSchema()\Rebing\GraphQL\GraphQL::queryAndReturnResult()(and thus also
\Rebing\GraphQL\GraphQL::query()) does not accept ad hoc schemas via
$opts['schema']anymore; it now only can reference a schema via its name.\Rebing\GraphQL\GraphQL::addSchema()now only acceptSchemaobjects,
where before it would support ad hoc schemas via array configuration.
Use\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()for that now.\Rebing\GraphQL\GraphQL::getSchemaConfiguration()has been removed due to
the simplifications.\Rebing\GraphQL\GraphQL::getNormalizedSchemaConfiguration()does not
support ad hoc schemas anymore and only accepts the schema name.\Rebing\GraphQL\GraphQLServiceProvider::bootSchemas()has been removed due
to the simplifications.
-
The following methods now take a
\Illuminate\Contracts\Config\Repositoryas
second argument:\Rebing\GraphQL\GraphQL::__construct\Rebing\GraphQL\GraphQLServiceProvider::applySecurityRules
-
As part of moving the architecture to an execution based middleware approach,
the following methods have been removed:\Rebing\GraphQL\GraphQLController::handleAutomaticPersistQuerieshas been
replaced by theAutomaticPersistedQueriesMiddlewaremiddleware\Rebing\GraphQL\GraphQLController::queryContexthas been
replaced by theAddAuthUserContextValueMiddlewaremiddleware
If you relied on overridingqueryContextto inject a custom context, you
now need to create your own execution middleware and add to your
configuration\Rebing\GraphQL\GraphQLController::executeQueryhas become obsolete, no
direct replacement.
-
Routing has been rewritten and simplified #757 / mfn
- All routing related configuration is now within the top level
route
configuration key - The following configuration options have been removed:
graphql.routes
It's therefore also not possible anymore to register different routes for
queries and mutations within a schema. Each schema gets only one route
(except for the default schema, which is registered for the global prefix
route as well as under its name).
If necessary, this can be emulated with different schemas and multi-level
paths
- The following configuration options have been moved/renamed:
graphql.prefix=>graphql.route.prefixgraphql.controllers=>graphql.route.controller
Further, providing a controller action forqueryormutationis not
supported anymore.graphql.middlware=>graphql.route.middlewaregraphql.route_group_attributes=>graphql.route.group_attributes
- The actual routes defined have changed:
- No more separate routes for the HTTP methods
- 1 route for each schema + 1 route for the group prefix (default schema)
- If GraphiQL is enabled: 1 route graphiql route for each schema + 1 for the
graphiql group prefix (default schema)
- It's now possible to prevent the registering of any routes by making the top
levelroutean empty array or null \Rebing\GraphQL\GraphQL::routeNameTransformerhas been removed- It's now possible to register schemas with a
-in their name - Routes are now properly cacheable
- All routing related configuration is now within the top level
-
Remove the
\Rebing\GraphQL\GraphQLController::$appproperty #755 / mfn
Injecting the application container early is incompatible when running within
an application server like laravel/octane, as it's not guaranteed that the
container received contains all the bindings. If you relied on this property
when extending the classes, invoke the container directly via
Container::getInstance(). -
Remove deprecated
\Rebing\GraphQL\Support\Type::$inputObjectand\Rebing\GraphQL\Support\Type::$enumObjectproperties #752 / mfn
Instead in your code, extend\Rebing\GraphQL\Support\InputTypeand\Rebing\GraphQL\Support\EnumTypedirectly -
Support for Lumen has been removed
-
Integrate laragraph/utils RequestParser #739 / mfn
The parsing of GraphQL requests is now more strict:- if you send a
GETrequest, the GraphQL query has to be in the query parameters - if you send a
POSTrequest, the GraphQL query needs to be in the body
Mixing of either isn't possible anymore - batched queries will only work with
POSTrequests
This is due toRequestParserusing\GraphQL\Server\Helper::parseRequestParamswhich includes this check
Further: - Drop support for configuration the name of the variable for the variables (
params_key) GraphQLUploadMiddlewarehas been removed (RequestParserincludes this functionality)- Empty GraphQL queries now return a proper validated GraphQL error
- if you send a
-
In
\Rebing\GraphQL\GraphQL, renamed remaining instances of$paramsto$variables
After switching toRequestParser, the support for changing the variable name
what was supposed toparams_keyhas gone and thus the name isn't fitting anymore.
Also, the default value for$variableshas been changed tonullto better
fit the howOperationParamsworks:-
old:
public function query(string $query, ?array $params = [], array $opts = []): array
new:public function query(string $query, ?array $variables = null, array $opts = []): array -
old:
public function queryAndReturnResult(string $query, ?array $params = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult(string $query, ?array $variables = null, array $opts = []): ExecutionResult -
\Rebing\GraphQL\Support\ResolveInfoFieldsAndArgumentshas been removed -
$getSelectFieldsclosure no longer takes a depth parameter
-
Added
- Command to make an execution middleware #772 / mfn
- The primary execution of the GraphQL request is now piped through middlewares #762 / crissi and mfn
This allows greater flexibility for enabling/disabling certain functionality
as well as bringing in new features without having to open up the library. - Primarily register \Rebing\GraphQL\GraphQL as service and keep
'graphql'as alias #768 / mfn - Automatic Persisted Queries (APQ) now cache the parsed query #740 / mfn
This avoids having to re-parse the same queries over and over again. - Add ability to detect unused GraphQL variables #660 / mfn
- Laravels
ValidationExceptionis now formatted the same way as aValidationError#748 / mfn
Changed
- Internally webonyx query plan feature is now used for retrieving information about a query #793 / crissi)
- Rewrite and simplify how schemas are handled #779 / mfn
- Internally stop using the global
config()function and preferable use the repository or the Facade otherwise #774 / mfn - Don't silence broken schemas when normalizing them for generating routes #766 / mfn
- Lazy loading types has been enabled by default #758 / mfn
Removed
- The method
\Rebing\GraphQL\GraphQLServiceProvider::provideswas removed #769 / mfn
It's only relevant for deferred providers which ours however isn't (and can't
be made into with the current Laravel architecture).
8.0.0-rc3 / Schema handling slightly revamped!
Due to some longer standing cleanups and embracing of a more standardized approach how to process the GraphQL request using https://github.com/laragraph/utils , a breaking changes were made for this next major version.
Note: compared to 8.0.0-rc2 , the schema handling as been changed!
To be clear (see below for details): you will need to adapt your configuration file
Breaking changes
-
Rewrite and simplify how schemas are handled
\Rebing\GraphQL\GraphQL::$schemasnow only holdsSchemas and not a
mixture of strings or arrays\Rebing\GraphQL\GraphQL::schema()now only accepts a "schema name", but no
ad hocSchemaor "schema configs". To use ad hoc schemas, use
\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()and
\Rebing\GraphQL\GraphQL::addSchema()\Rebing\GraphQL\GraphQL::queryAndReturnResult()(and thus also
\Rebing\GraphQL\GraphQL::query()) does not accept ad hoc schemas via
$opts['schema']anymore; it now only can reference a schema via its name.\Rebing\GraphQL\GraphQL::addSchema()now only acceptSchemaobjects,
where before it would support ad hoc schemas via array configuration.
Use\Rebing\GraphQL\GraphQL::buildSchemaFromConfig()for that now.\Rebing\GraphQL\GraphQL::getSchemaConfiguration()has been removed due to
the simplifications.\Rebing\GraphQL\GraphQL::getNormalizedSchemaConfiguration()does not
support ad hoc schemas anymore and only accepts the schema name.\Rebing\GraphQL\GraphQLServiceProvider::bootSchemas()has been removed due
to the simplifications.
-
The following methods now take a
\Illuminate\Contracts\Config\Repositoryas
second argument:\Rebing\GraphQL\GraphQL::__construct\Rebing\GraphQL\GraphQLServiceProvider::applySecurityRules
-
As part of moving the architecture to an execution based middleware approach,
the following methods have been removed:\Rebing\GraphQL\GraphQLController::handleAutomaticPersistQuerieshas been
replaced by theAutomaticPersistedQueriesMiddlewaremiddleware\Rebing\GraphQL\GraphQLController::queryContexthas been
replaced by theAddAuthUserContextValueMiddlewaremiddleware
If you relied on overridingqueryContextto inject a custom context, you
now need to create your own execution middleware and add to your
configuration\Rebing\GraphQL\GraphQLController::executeQueryhas become obsolete, no
direct replacement.
-
Routing has been rewritten and simplified #757 / mfn
- All routing related configuration is now within the top level
route
configuration key - The following configuration options have been removed:
graphql.routes
It's therefore also not possible anymore to register different routes for
queries and mutations within a schema. Each schema gets only one route
(except for the default schema, which is registered for the global prefix
route as well as under its name).
If necessary, this can be emulated with different schemas and multi-level
paths
- The following configuration options have been moved/renamed:
graphql.prefix=>graphql.route.prefixgraphql.controllers=>graphql.route.controller
Further, providing a controller action forqueryormutationis not
supported anymore.graphql.middlware=>graphql.route.middlewaregraphql.route_group_attributes=>graphql.route.group_attributes
- The actual routes defined have changed:
- No more separate routes for the HTTP methods
- 1 route for each schema + 1 route for the group prefix (default schema)
- If GraphiQL is enabled: 1 route graphiql route for each schema + 1 for the
graphiql group prefix (default schema) - This also means that the per schema config key
method(aka HTTP method)
is not supported anymore
- It's now possible to prevent the registering of any routes by making the top
levelroutean empty array or null \Rebing\GraphQL\GraphQL::routeNameTransformerhas been removed- It's now possible to register schemas with a
-in their name - Routes are now properly cacheable
- All routing related configuration is now within the top level
-
Remove the
\Rebing\GraphQL\GraphQLController::$appproperty #755 / mfn
Injecting the application container early is incompatible when running within
an application server like laravel/octane, as it's not guaranteed that the
container received contains all the bindings. If you relied on this property
when extending the classes, invoke the container directly via
Container::getInstance(). -
Remove deprecated
\Rebing\GraphQL\Support\Type::$inputObjectand\Rebing\GraphQL\Support\Type::$enumObjectproperties #752 / mfn
Instead in your code, extend\Rebing\GraphQL\Support\InputTypeand\Rebing\GraphQL\Support\EnumTypedirectly -
Support for Lumen has been removed
-
Integrate laragraph/utils RequestParser #739 / mfn
The parsing of GraphQL requests is now more strict:- if you send a
GETrequest, the GraphQL query has to be in the query parameters - if you send a
POSTrequest, the GraphQL query needs to be in the body
Mixing of either isn't possible anymore - batched queries will only work with
POSTrequests
This is due toRequestParserusing\GraphQL\Server\Helper::parseRequestParamswhich includes this check
Further: - Drop support for configuration the name of the variable for the variables (
params_key) GraphQLUploadMiddlewarehas been removed (RequestParserincludes this functionality)- Empty GraphQL queries now return a proper validated GraphQL error
- if you send a
-
In
\Rebing\GraphQL\GraphQL, renamed remaining instances of$paramsto$variables
After switching toRequestParser, the support for changing the variable name
what was supposed toparams_keyhas gone and thus the name isn't fitting anymore.
Also, the default value for$variableshas been changed tonullto better
fit the howOperationParamsworks:- old:
public function query(string $query, ?array $params = [], array $opts = []): array
new:public function query(string $query, ?array $variables = null, array $opts = []): array - old:
public function queryAndReturnResult(string $query, ?array $params = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult(string $query, ?array $variables = null, array $opts = []): ExecutionResult
- old:
Added
- Command to make an exection middleware #772 / mfn
- The primary execution of the GraphQL request is now piped through middlewares #762 / crissi and mfn
This allows greater flexibility for enabling/disabling certain functionality
as well as bringing in new features without having to open up the library. - Primarily register \Rebing\GraphQL\GraphQL as service and keep
'graphql'as alias #768 / mfn - Automatic Persisted Queries (APQ) now cache the parsed query #740 / mfn
This avoids having to re-parse the same queries over and over again. - Add ability to detect unused GraphQL variables #660 / mfn
- Laravels
ValidationExceptionis now formatted the same way as aValidationError#748 / mfn
Changed
- Rewrite and simplify how schemas are handled #779 / mfn
- Internally stop using the global
config()function and preferable use the repository or the Facade otherwise #774 / mfn - Don't silence broken schemas when normalizing them for generating routes #766 / mfn
- Lazy loading types has been enabled by default #758 / mfn
Removed
- The method
\Rebing\GraphQL\GraphQLServiceProvider::provideswas removed #769 / mfn
It's only relevant for deferred providers which ours however isn't (and can't
be made into with the current Laravel architecture).
8.0.0-rc2 / More Breaking Changes incoming!
Due to some longer standing cleanups, embracing of a more standardized approach how to process the GraphQL request using https://github.com/laragraph/utils, and adding a execution middleware, breaking changes were made for this next major version.
Note: the "breaking changes" between 8.0.0-rc1 and rc2 changed, again; please see the full and current changelog below
To be clear (see below for details): you will need to adapt your configuration file
Breaking changes
-
As part of moving the architecture to an execution based middleware approach,
the following methods have been removed:\Rebing\GraphQL\GraphQLController::handleAutomaticPersistQuerieshas been
replaced by theAutomaticPersistedQueriesMiddlewaremiddleware\Rebing\GraphQL\GraphQLController::queryContexthas been
replaced by theAddAuthUserContextValueMiddlewaremiddleware
If you relied on overridingqueryContextto inject a custom context, you
now need to create your own execution middleware and add to your
configuration\Rebing\GraphQL\GraphQLController::executeQueryhas become obsolete, no
direct replacement.
-
Routing has been rewritten and simplified #757 / mfn
- All routing related configuration is now within the top level
route
configuration key - The following configuration options have been removed:
graphql.routes
It's therefore also not possible anymore to register different routes for
queries and mutations within a schema. Each schema gets only one route
(except for the default schema, which is registered for the global prefix
route as well as under its name).
If necessary, this can be emulated with different schemas and multi-level
paths
- The following configuration options have been moved/renamed:
graphql.prefix=>graphql.route.prefixgraphql.controllers=>graphql.route.controller
Further, providing a controller action forqueryormutationis not
supported anymore.graphql.middlware=>graphql.route.middlewaregraphql.route_group_attributes=>graphql.route.group_attributes
- The actual routes defined have changed:
- No more separate routes for the HTTP methods
- 1 route for each schema + 1 route for the group prefix (default schema)
- If GraphiQL is enabled: 1 route graphiql route for each schema + 1 for the
graphiql group prefix (default schema) - This also means that the per schema config key
method(aka HTTP method)
is not supported anymore
- It's now possible to prevent the registering of any routes by making the top
levelroutean empty array or null \Rebing\GraphQL\GraphQL::routeNameTransformerhas been removed- It's now possible to register schemas with a
-in their name - Routes are now properly cacheable
- All routing related configuration is now within the top level
-
Remove the
\Rebing\GraphQL\GraphQLController::$appproperty #755 / mfn
Injecting the application container early is incompatible when running within
an application server like laravel/octane, as it's not guaranteed that the
container received contains all the bindings. If you relied on this property
when extending the classes, invoke the container directly via
Container::getInstance(). -
Remove deprecated
\Rebing\GraphQL\Support\Type::$inputObjectand\Rebing\GraphQL\Support\Type::$enumObjectproperties #752 / mfn
Instead in your code, extend\Rebing\GraphQL\Support\InputTypeand\Rebing\GraphQL\Support\EnumTypedirectly -
Support for Lumen has been removed
-
Integrate laragraph/utils RequestParser #739 / mfn
The parsing of GraphQL requests is now more strict:- if you send a
GETrequest, the GraphQL query has to be in the query parameters - if you send a
POSTrequest, the GraphQL query needs to be in the body
Mixing of either isn't possible anymore - batched queries will only work with
POSTrequests
This is due toRequestParserusing\GraphQL\Server\Helper::parseRequestParamswhich includes this check
Further: - Drop support for configuration the name of the variable for the variables (
params_key) GraphQLUploadMiddlewarehas been removed (RequestParserincludes this functionality)- Empty GraphQL queries now return a proper validated GraphQL error
- if you send a
-
In
\Rebing\GraphQL\GraphQL, renamed remaining instances of$paramsto$variables
After switching toRequestParser, the support for changing the variable name
what was supposed toparams_keyhas gone and thus the name isn't fitting anymore.
Also, the default value for$variableshas been changed tonullto better
fit the howOperationParamsworks:- old:
public function query(string $query, ?array $params = [], array $opts = []): array
new:public function query(string $query, ?array $variables = null, array $opts = []): array - old:
public function queryAndReturnResult(string $query, ?array $params = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult(string $query, ?array $variables = null, array $opts = []): ExecutionResult
- old:
Added
- The primary execution of the GraphQL request is now piped through middlewares #762 / crissi and mfn
This allows greater flexibility for enabling/disabling certain functionality
as well as bringing in new features without having to open up the library. - Primarily register \Rebing\GraphQL\GraphQL as service and keep
'graphql'as alias #768 / mfn - Automatic Persisted Queries (APQ) now cache the parsed query #740 / mfn
This avoids having to re-parse the same queries over and over again. - Add ability to detect unused GraphQL variables #660 / mfn
- Laravels
ValidationExceptionis now formatted the same way as aValidationError#748 / mfn
Changed
- Don't silence broken schemas when normalizing them for generating routes #766 / mfn
- Lazy loading types has been enabled by default #758 / mfn
Removed
- The method
\Rebing\GraphQL\GraphQLServiceProvider::provideswas removed #769 / mfn
It's only relevant for deferred providers which ours however isn't (and can't
be made into with the current Laravel architecture).
8.0.0-rc1 / Breaking Changes incoming!
Due to some longer standing cleanups and embracing of a more standardized approach how to process the GraphQL request using https://github.com/laragraph/utils , a few breaking changes were made for this next major version.
To be clear (see below for details): you will need to adapt your configuration file
Breaking changes
-
Routing has been rewritten and simplified #757 / mfn
- All routing related configuration is now within the top level
route
configuration key - The following configuration options have been removed:
graphql.routes
It's therefore also not possible anymore to register different routes for
queries and mutations within a schema. Each schema gets only one route
(except for the default schema, which is registered for the global prefix
route as well as under its name).
If necessary, this can be emulated with different schemas and multi-level
paths
- The following configuration options have been moved/renamed:
graphql.prefix=>graphql.route.prefixgraphql.controllers=>graphql.route.controller
Further, providing a controller action forqueryormutationis not
supported anymore.graphql.middlware=>graphql.route.middlewaregraphql.route_group_attributes=>graphql.route.group_attributes
- The actual routes defined have changed:
- No more separate routes for the HTTP methods
- 1 route for each schema + 1 route for the group prefix (default schema)
- If GraphiQL is enabled: 1 route graphiql route for each schema + 1 for the
graphiql group prefix (default schema)
- It's now possible to prevent the registering of any routes by making the top
levelroutean empty array or null \Rebing\GraphQL\GraphQL::routeNameTransformerhas been removed- It's not possible to register schemas with a
-in their name
- All routing related configuration is now within the top level
-
Remove the
\Rebing\GraphQL\GraphQLController::$appproperty #755 / mfn
Injecting the application container early is incompatible when running within
an application server like laravel/octane, as it's not guaranteed that the
container received contains all the bindings. If you relied on this property
when extending the classes, invoke the container directly via
Container::getInstance(). -
Remove deprecated
\Rebing\GraphQL\Support\Type::$inputObjectand\Rebing\GraphQL\Support\Type::$enumObjectproperties #752 / mfn
Instead in your code, extend\Rebing\GraphQL\Support\InputTypeand\Rebing\GraphQL\Support\EnumTypedirectly -
Support for Lumen has been removed
-
Integrate laragraph/utils RequestParser #739 / mfn
The parsing of GraphQL requests is now more strict:- if you send a
GETrequest, the GraphQL query has to be in the query parameters - if you send a
POSTrequest, the GraphQL query needs to be in the body
Mixing of either isn't possible anymore
Further: - batched queries will only work with
POSTrequests
This is due toRequestParserusing\GraphQL\Server\Helper::parseRequestParamswhich includes this check - Drop support for configuration the name of the variable for the variables (
params_key) GraphQLUploadMiddlewarehas been removed (RequestParserincludes this functionality)- Empty GraphQL queries now return a proper validated GraphQL error
- Signature changes In
\Rebing\GraphQL\GraphQLController:- old:
protected function executeQuery(string $schema, array $input): array
new:protected function executeQuery(string $schema, OperationParams $params): array - old:
protected function queryContext(string $query, ?array $params, string $schema)
new:protected function queryContext(string $query, ?array $variables, string $schema) - old:
protected function handleAutomaticPersistQueries(string $schemaName, array $input): string
new:protected function handleAutomaticPersistQueries(string $schemaName, OperationParams $operation): string
- old:
- if you send a
-
In
\Rebing\GraphQL\GraphQLController, renamed all occurrences of$schemato$schemaName
This is to reduce the confusion as the code in some other places uses$schema
for the actual schema itself (either as an object or array form).
This changes the signature on the following methods:- old:
protected function executeQuery(string $schema, OperationParams $params): array
new:protected function executeQuery(string $schemaName, OperationParams $params): array - old:
protected function queryContext(string $query, ?array $variables, string $schema)
new:protected function queryContext(string $query, ?array $variables, string $schemaName)
- old:
-
In
\Rebing\GraphQL\GraphQL, renamed remaining instances of$paramsto$variables
After switching toRequestParser, the support for changing the variable name
what was supposed toparams_keyhas gone and thus the name isn't fitting anymore- old:
public function query(string $query, ?array $params = [], array $opts = []): array
new:public function query(string $query, ?array $variables = [], array $opts = []): array - old:
public function queryAndReturnResult(string $query, ?array $params = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult(string $query, ?array $variables = [], array $opts = []): ExecutionResult
- old:
-
As part of APQ parsed query support #740 / mfn:
- In
\Rebing\GraphQL\GraphQLController, the following signature changed:- old:
protected function handleAutomaticPersistQueries(string $schemaName, OperationParams $operation): string
new:protected function handleAutomaticPersistQueries(string $schemaName, OperationParams $operation): array
- old:
- In
\Rebing\GraphQL\GraphQL, the following signature changed:- old:
public function query(string $query, ?array $variables = [], array $opts = []): array
new:public function query($query, ?array $variables = [], array $opts = []): array - old:
public function queryAndReturnResult(string $query, ?array $variables = [], array $opts = []): ExecutionResult
new:public function queryAndReturnResult($query, ?array $variables = [], array $opts = []): ExecutionResult
- old:
- In
Added
- Automatic Persisted Queries (APQ) now cache the parsed query #740 / mfn
This avoids having to re-parse the same queries over and over again. - Add ability to detect unused GraphQL variables #660 / mfn
- Laravels
ValidationExceptionis now formatted the same way as aValidationError#748 / mfn
Changed
- Lazy loading types has been enabled by default #758 / mfn