File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
Resources/config/container Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 54
54
55
55
<service id =" TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface" alias =" TheCodingMachine\Graphqlite\Bundle\Security\AuthorizationService" />
56
56
57
- <service id =" GraphQL\Server\ServerConfig" >
57
+ <service id =" GraphQL\Server\ServerConfig" class = " TheCodingMachine\Graphqlite\Bundle\Server\ServerConfig " >
58
58
<call method =" setSchema" >
59
59
<argument type =" service" id =" TheCodingMachine\GraphQLite\Schema" />
60
60
</call >
109
109
</argument >
110
110
<tag name =" graphql.type_mapper_factory" />
111
111
</service >
112
-
112
+
113
113
<service id =" graphqlite.phpfilescache" class =" Symfony\Component\Cache\Adapter\PhpFilesAdapter" >
114
114
<argument >graphqlite</argument >
115
115
</service >
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+
4
+ namespace TheCodingMachine \Graphqlite \Bundle \Server ;
5
+
6
+ use GraphQL \Error \InvariantViolation ;
7
+ use GraphQL \Utils \Utils ;
8
+ use GraphQL \Validator \DocumentValidator ;
9
+ use GraphQL \Validator \Rules \ValidationRule ;
10
+ use function array_merge ;
11
+ use function is_array ;
12
+ use function is_callable ;
13
+
14
+ /**
15
+ * A slightly modified version of the server config: default validators are added by default when setValidators is called.
16
+ */
17
+ class ServerConfig extends \GraphQL \Server \ServerConfig
18
+ {
19
+ /**
20
+ * Set validation rules for this server, AND adds by default all the "default" validation rules provided by Webonyx
21
+ *
22
+ * @param ValidationRule[]|callable $validationRules
23
+ *
24
+ * @return \GraphQL\Server\ServerConfig
25
+ *
26
+ * @api
27
+ */
28
+ public function setValidationRules ($ validationRules )
29
+ {
30
+ parent ::setValidationRules (array_merge (DocumentValidator::defaultRules (), $ validationRules ));
31
+
32
+ return $ this ;
33
+ }
34
+
35
+ }
You can’t perform that action at this time.
0 commit comments