@@ -25,15 +25,23 @@ parameters:
2525 #
2626 # By default, this uses the GraphQL schema provided by the module.
2727 #
28- # @default \Drupal\graphql\Schema
29- schema_class : Drupal\graphql\GraphQL\Schema
28+ # @default \Drupal\graphql\GraphQL\Schema\ Schema
29+ schema_class : Drupal\graphql\GraphQL\Schema\Schema
3030
3131services :
32+ # Logger channel for graphql related log entries.
33+ logger.channel.graphql :
34+ parent : logger.channel_base
35+ arguments : ['graphql']
36+
37+ # Check access for executing graphql queries.
3238 access_check.graphql.query :
3339 class : Drupal\graphql\Access\QueryAccessCheck
3440 arguments : ['@request_stack']
3541 tags :
3642 - { name: access_check, applies_to: _graphql_query_access }
43+
44+ # Schema and schema metadata cache bin.
3745 cache.graphql_schema :
3846 class : Drupal\Core\Cache\CacheBackendInterface
3947 tags :
@@ -46,6 +54,8 @@ services:
4654 - { name: cache.bin }
4755 factory : cache_factory:get
4856 arguments : [graphql_schema_metadata]
57+
58+ # Response and response metadata cache bin.
4959 cache.graphql_response :
5060 class : Drupal\Core\Cache\CacheBackendInterface
5161 tags :
@@ -58,18 +68,30 @@ services:
5868 - { name: cache.bin }
5969 factory : cache_factory:get
6070 arguments : [graphql_response_metadata]
71+
72+ # Cache context for graphql request parameters.
6173 cache_context.gql :
6274 class : Drupal\graphql\Cache\Context\QueryCacheContext
6375 arguments : ['@request_stack']
6476 tags :
6577 - { name: cache.context }
78+
79+ # Schema and processor factory.
80+ graphql.query_processor :
81+ class : Drupal\graphql\GraphQL\Execution\QueryProcessor
82+ arguments :
83+ - ' @service_container'
84+ - ' @graphql.schema'
85+ - ' @graphql.reducer_manager'
86+ - ' @current_user'
87+ - ' %graphql.config%'
6688 graphql.schema :
67- class : Drupal\graphql\GraphQL\Schema
89+ class : Drupal\graphql\GraphQL\Schema\Schema
6890 factory : ['@graphql.schema_factory', getSchema]
6991 tags :
7092 - { name: graphql_extra_cache_metadata }
7193 graphql.schema_factory :
72- class : Drupal\graphql\SchemaFactory
94+ class : Drupal\graphql\GraphQL\Schema\ SchemaFactory
7395 arguments :
7496 - ' @cache_contexts_manager'
7597 - ' @request_stack'
@@ -78,22 +100,19 @@ services:
78100 - ' @cache.graphql_schema_metadata'
79101 - ' %graphql.config%'
80102 tags :
81- - { name: service_collector, tag: graphql_extra_schema_cache_metadata, call: addExtraCacheMetadata }
82- graphql.query_processor :
83- class : Drupal\graphql\QueryProcessor
84- arguments :
85- - ' @service_container'
86- - ' @graphql.schema'
87- - ' @graphql.reducer_manager'
88- - ' @current_user'
89- - ' %graphql.config%'
103+ - { name: service_collector, tag: graphql_extra_schema_cache_metadata, call: addExtraCacheMetadata }
104+
105+ # Global cache metadata to add to every graphql schema.
106+ # TODO: This needs to be refactored.
90107 graphql.extra_schema_cache_metadata :
91108 class : Drupal\Core\Cache\CacheableMetadata
92109 calls :
93110 - { method: addCacheContexts, arguments: [['languages:language_interface']] }
94111 - { method: addCacheTags, arguments: [['graphql_schema']] }
95112 tags :
96113 - { name: graphql_extra_schema_cache_metadata }
114+
115+ # Composite service for gathering schemas.
97116 graphql.schema_provider :
98117 class : Drupal\graphql\SchemaProvider\SchemaProvider
99118 arguments : ['%graphql.config%']
@@ -103,22 +122,31 @@ services:
103122 class : Drupal\graphql\QueryMapProvider\QueryMapProvider
104123 tags :
105124 - { name: service_collector, tag: graphql_query_map_provider, call: addQueryMapProvider }
125+
126+ # Manager for schema reducers. Uses a compiler pass to gather reducers.
106127 graphql.reducer_manager :
107- class : Drupal\graphql\Reducers\ReducerManager
128+ class : Drupal\graphql\GraphQL\ Reducers\ReducerManager
108129 arguments : ['@service_container', '%graphql.reducers%']
130+
131+ # Service for graphql request caching.
109132 graphql.cache_subscriber :
110133 class : Drupal\graphql\EventSubscriber\CacheSubscriber
111134 arguments : ['@graphql.request_policy', '@graphql.response_policy', '@current_route_match', '@request_stack', '@cache.graphql_response', '@cache.graphql_response_metadata', '@cache_contexts_manager', '%graphql.config%']
112135 tags :
113136 - { name: service_collector, tag: graphql_extra_cache_metadata, call: addExtraCacheMetadata }
114137 - { name: event_subscriber }
138+
139+ # Global cache metadata to add to every graphql request.
140+ # TODO: This needs to be refactored.
115141 graphql.extra_cache_metadata :
116142 class : Drupal\Core\Cache\CacheableMetadata
117143 calls :
118144 - { method: addCacheContexts, arguments: [['gql', 'user']] }
119145 - { method: addCacheTags, arguments: [['graphql_response']] }
120146 tags :
121147 - { name: graphql_extra_cache_metadata }
148+
149+ # Cache request and response policies for graphql requests.
122150 graphql.request_policy :
123151 class : Drupal\Core\PageCache\ChainRequestPolicy
124152 tags :
@@ -142,12 +170,157 @@ services:
142170 arguments : ['@path_processor_manager']
143171 tags :
144172 - { name: graphql_request_policy }
173+
174+ # Upcasting for graphql query request parameters.
145175 graphql.route_enhancer.query :
146176 class : Drupal\graphql\Routing\QueryRouteEnhancer
147177 arguments : ['@graphql.query_map_provider']
148178 tags :
149179 - { name: route_enhancer }
180+
181+ # Schema introspection service.
150182 graphql.introspection :
151- class : Drupal\graphql\Introspection
183+ class : Drupal\graphql\GraphQL\Utility\ Introspection
152184 arguments : ['@service_container', '@graphql.reducer_manager', '@graphql.schema']
153185
186+ # Support for subrequests.
187+ graphql.subrequest_subscriber :
188+ class : Drupal\graphql\EventSubscriber\SubrequestSubscriber
189+ tags :
190+ - { name: event_subscriber }
191+ graphql.context_repository :
192+ class : Drupal\graphql\GraphQL\Context\ContextRepository
193+ tags :
194+ - { name: service_collector, tag: context_provider, call: addContextProvider }
195+
196+ # Support for deferred / batched field resolvers.
197+ graphql.batched_resolver :
198+ class : Drupal\graphql\GraphQL\Batching\BatchedFieldResolver
199+
200+ # Schema provider based on plugin system.
201+ graphql.schema_provider.pluggable :
202+ class : Drupal\graphql\SchemaProvider\PluggableSchemaProvider
203+ arguments :
204+ - ' @graphql.pluggable_schema_manager'
205+ tags :
206+ - { name: graphql_schema_provider }
207+
208+ # Plugin system based schema manager.
209+ graphql.pluggable_schema_manager :
210+ class : Drupal\graphql\Plugin\GraphQL\PluggableSchemaManager
211+ tags :
212+ - { name: service_collector, tag: graphql_plugin_manager, call: addPluginManager }
213+
214+ # Plugin manager implementations for schema types.
215+ plugin.manager.graphql.union_type :
216+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
217+ tags :
218+ - { name: graphql_plugin_manager }
219+ calls :
220+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
221+ arguments :
222+ - ' Plugin/GraphQL/UnionTypes'
223+ - ' @container.namespaces'
224+ - ' @module_handler'
225+ - ' \Drupal\graphql\Plugin\GraphQL\Unions\UnionTypePluginBase'
226+ - ' \Drupal\graphql\Annotation\GraphQLUnionType'
227+ - ' graphql_union_types'
228+ - ' @logger.channel.graphql'
229+ plugin.manager.graphql.interface :
230+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
231+ tags :
232+ - { name: graphql_plugin_manager }
233+ calls :
234+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
235+ arguments :
236+ - ' Plugin/GraphQL/Interfaces'
237+ - ' @container.namespaces'
238+ - ' @module_handler'
239+ - ' \Drupal\graphql\Plugin\GraphQL\Interfaces\InterfacePluginBase'
240+ - ' \Drupal\graphql\Annotation\GraphQLInterface'
241+ - ' graphql_interfaces'
242+ - ' @logger.channel.graphql'
243+ plugin.manager.graphql.type :
244+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
245+ tags :
246+ - { name: graphql_plugin_manager }
247+ calls :
248+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
249+ arguments :
250+ - ' Plugin/GraphQL/Types'
251+ - ' @container.namespaces'
252+ - ' @module_handler'
253+ - ' \Drupal\graphql\Plugin\GraphQL\Types\TypePluginBase'
254+ - ' \Drupal\graphql\Annotation\GraphQLType'
255+ - ' graphql_types'
256+ - ' @logger.channel.graphql'
257+ plugin.manager.graphql.input_type :
258+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
259+ tags :
260+ - { name: graphql_plugin_manager }
261+ calls :
262+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
263+ arguments :
264+ - ' Plugin/GraphQL/InputTypes'
265+ - ' @container.namespaces'
266+ - ' @module_handler'
267+ - ' \Drupal\graphql\Plugin\GraphQL\InputTypes\InputTypePluginBase'
268+ - ' \Drupal\graphql\Annotation\GraphQLInputType'
269+ - ' graphql_input_types'
270+ - ' @logger.channel.graphql'
271+ plugin.manager.graphql.field :
272+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
273+ tags :
274+ - { name: graphql_plugin_manager }
275+ calls :
276+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
277+ arguments :
278+ - ' Plugin/GraphQL/Fields'
279+ - ' @container.namespaces'
280+ - ' @module_handler'
281+ - ' \Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase'
282+ - ' \Drupal\graphql\Annotation\GraphQLField'
283+ - ' graphql_fields'
284+ - ' @logger.channel.graphql'
285+ plugin.manager.graphql.mutation :
286+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
287+ tags :
288+ - { name: graphql_plugin_manager }
289+ calls :
290+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
291+ arguments :
292+ - ' Plugin/GraphQL/Mutations'
293+ - ' @container.namespaces'
294+ - ' @module_handler'
295+ - ' \Drupal\graphql\Plugin\GraphQL\Mutations\MutationPluginBase'
296+ - ' \Drupal\graphql\Annotation\GraphQLMutation'
297+ - ' graphql_mutations'
298+ - ' @logger.channel.graphql'
299+ plugin.manager.graphql.scalar :
300+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
301+ tags :
302+ - { name: graphql_plugin_manager }
303+ calls :
304+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
305+ arguments :
306+ - ' Plugin/GraphQL/Scalars'
307+ - ' @container.namespaces'
308+ - ' @module_handler'
309+ - ' \Youshido\GraphQL\Type\TypeInterface'
310+ - ' \Drupal\graphql\Annotation\GraphQLScalar'
311+ - ' graphql_scalars'
312+ - ' @logger.channel.graphql'
313+ plugin.manager.graphql.enum :
314+ class : Drupal\graphql\Plugin\GraphQL\TypeSystemPluginManager
315+ tags :
316+ - { name: graphql_plugin_manager }
317+ calls :
318+ - [setSchemaManager, ['@graphql.pluggable_schema_manager']]
319+ arguments :
320+ - ' Plugin/GraphQL/Enums'
321+ - ' @container.namespaces'
322+ - ' @module_handler'
323+ - ' \Drupal\graphql\Plugin\GraphQL\Enums\EnumPluginBase'
324+ - ' \Drupal\graphql\Annotation\GraphQLEnum'
325+ - ' graphql_enums'
326+ - ' @logger.channel.graphql'
0 commit comments