@@ -43,13 +43,19 @@ class GraphQL
4343 * A resolver function to use when one is not provided by the schema.
4444 * If not provided, the default field resolver is used (which looks for a
4545 * value or method on the source value with the field's name).
46+ * validationRules:
47+ * A set of rules for query validation step. Default value is all available rules.
48+ * Empty array would allow to skip query validation (may be convenient for persisted
49+ * queries which are validated before persisting and assumed valid during execution)
4650 *
4751 * @param Schema $schema
4852 * @param string|DocumentNode $source
4953 * @param mixed $rootValue
54+ * @param array $contextValue
5055 * @param array|null $variableValues
5156 * @param string|null $operationName
5257 * @param callable $fieldResolver
58+ * @param array $validationRules
5359 * @param PromiseAdapter $promiseAdapter
5460 *
5561 * @return Promise|array
@@ -62,6 +68,7 @@ public static function execute(
6268 $ variableValues = null ,
6369 $ operationName = null ,
6470 callable $ fieldResolver = null ,
71+ array $ validationRules = null ,
6572 PromiseAdapter $ promiseAdapter = null
6673 )
6774 {
@@ -73,6 +80,7 @@ public static function execute(
7380 $ variableValues ,
7481 $ operationName ,
7582 $ fieldResolver ,
83+ $ validationRules ,
7684 $ promiseAdapter
7785 );
7886
@@ -98,6 +106,7 @@ public static function execute(
98106 * @param array|null $variableValues
99107 * @param string|null $operationName
100108 * @param callable $fieldResolver
109+ * @param array $validationRules
101110 * @param PromiseAdapter $promiseAdapter
102111 *
103112 * @return ExecutionResult|Promise
@@ -110,6 +119,7 @@ public static function executeAndReturnResult(
110119 $ variableValues = null ,
111120 $ operationName = null ,
112121 callable $ fieldResolver = null ,
122+ array $ validationRules = null ,
113123 PromiseAdapter $ promiseAdapter = null
114124 )
115125 {
@@ -124,7 +134,7 @@ public static function executeAndReturnResult(
124134 $ queryComplexity = DocumentValidator::getRule ('QueryComplexity ' );
125135 $ queryComplexity ->setRawVariableValues ($ variableValues );
126136
127- $ validationErrors = DocumentValidator::validate ($ schema , $ documentNode );
137+ $ validationErrors = DocumentValidator::validate ($ schema , $ documentNode, $ validationRules );
128138
129139 if (!empty ($ validationErrors )) {
130140 return new ExecutionResult (null , $ validationErrors );
0 commit comments