jsonapi.services.yml
Same filename in other branches
File
-
core/
modules/ jsonapi/ jsonapi.services.yml
View source
- parameters:
- jsonapi.base_path: /jsonapi
-
- services:
- _defaults:
- autoconfigure: true
- jsonapi.serializer:
- class: Drupal\jsonapi\Serializer\Serializer
- calls:
- - [setFallbackNormalizer, ['@serializer']]
- arguments: [{ }, { }]
- serializer.normalizer.http_exception.jsonapi:
- class: Drupal\jsonapi\Normalizer\HttpExceptionNormalizer
- arguments: ['@current_user']
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.unprocessable_entity_exception.jsonapi:
- class: Drupal\jsonapi\Normalizer\UnprocessableHttpEntityExceptionNormalizer
- arguments: ['@current_user']
- tags:
- # This must have a higher priority than the 'serializer.normalizer.http_exception.jsonapi' to take effect.
- - { name: jsonapi_normalizer, priority: 1 }
- serializer.normalizer.entity_access_exception.jsonapi:
- class: Drupal\jsonapi\Normalizer\EntityAccessDeniedHttpExceptionNormalizer
- arguments: ['@current_user']
- tags:
- # This must have a higher priority than the 'serializer.normalizer.http_exception.jsonapi' to take effect.
- - { name: jsonapi_normalizer, priority: 1 }
- serializer.normalizer.field_item.jsonapi:
- class: Drupal\jsonapi\Normalizer\FieldItemNormalizer
- arguments: ['@entity_type.manager']
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.field.jsonapi:
- class: Drupal\jsonapi\Normalizer\FieldNormalizer
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.resource_identifier.jsonapi:
- class: Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer
- arguments: ['@entity_field.manager']
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.data.jsonapi:
- class: Drupal\jsonapi\Normalizer\DataNormalizer
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.resource_object.jsonapi:
- class: Drupal\jsonapi\Normalizer\ResourceObjectNormalizer
- arguments: ['@jsonapi.normalization_cacher']
- tags:
- - { name: jsonapi_normalizer }
- jsonapi.normalization_cacher:
- class: Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher
- calls:
- - ['setVariationCache', ['@variation_cache.jsonapi_normalizations']]
- - ['setRequestStack', ['@request_stack']]
- serializer.normalizer.content_entity.jsonapi:
- class: Drupal\jsonapi\Normalizer\ContentEntityDenormalizer
- arguments: ['@entity_type.manager', '@entity_field.manager', '@plugin.manager.field.field_type']
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.config_entity.jsonapi:
- class: Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer
- arguments: ['@entity_type.manager', '@entity_field.manager', '@plugin.manager.field.field_type']
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.jsonapi_document_toplevel.jsonapi:
- class: Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer
- arguments: ['@entity_type.manager', '@jsonapi.resource_type.repository']
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.link_collection.jsonapi:
- class: Drupal\jsonapi\Normalizer\LinkCollectionNormalizer
- arguments: ['@current_user']
- tags:
- - { name: jsonapi_normalizer }
- serializer.normalizer.relationship.jsonapi:
- class: Drupal\jsonapi\Normalizer\RelationshipNormalizer
- tags:
- - { name: jsonapi_normalizer }
- serializer.encoder.jsonapi:
- class: Drupal\jsonapi\Encoder\JsonEncoder
- tags:
- - { name: jsonapi_encoder, format: 'api_json' }
- jsonapi.resource_type.repository:
- class: Drupal\jsonapi\ResourceType\ResourceTypeRepository
- arguments: ['@entity_type.manager', '@entity_type.bundle.info', '@entity_field.manager', '@cache.jsonapi_resource_types', '@event_dispatcher']
- Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface: '@jsonapi.resource_type.repository'
- jsonapi.route_enhancer:
- class: Drupal\jsonapi\Routing\RouteEnhancer
- tags:
- - { name: route_enhancer }
- jsonapi.field_resolver:
- class: Drupal\jsonapi\Context\FieldResolver
- arguments: ['@entity_type.manager', '@entity_field.manager', '@entity_type.bundle.info', '@jsonapi.resource_type.repository', '@module_handler', '@current_user']
- Drupal\jsonapi\Context\FieldResolver: '@jsonapi.field_resolver'
- jsonapi.include_resolver:
- class: Drupal\jsonapi\IncludeResolver
- arguments:
- - '@entity_type.manager'
- - '@jsonapi.entity_access_checker'
- Drupal\jsonapi\IncludeResolver: '@jsonapi.include_resolver'
- paramconverter.jsonapi.entity_uuid:
- parent: paramconverter.entity
- class: Drupal\jsonapi\ParamConverter\EntityUuidConverter
- calls:
- - [setLanguageManager, ['@language_manager']]
- tags:
- # Priority 10, to ensure it runs before @paramconverter.entity.
- - { name: paramconverter, priority: 10 }
- paramconverter.jsonapi.resource_type:
- class: Drupal\jsonapi\ParamConverter\ResourceTypeConverter
- arguments: ['@jsonapi.resource_type.repository']
- tags:
- - { name: paramconverter }
- jsonapi.exception_subscriber:
- class: Drupal\jsonapi\EventSubscriber\DefaultExceptionSubscriber
- arguments: ['@jsonapi.serializer', '%serializer.formats%']
-
- logger.channel.jsonapi:
- parent: logger.channel_base
- arguments: ['jsonapi']
-
- # Cache.
- cache.jsonapi_memory:
- class: Drupal\Core\Cache\MemoryCache\MemoryCacheInterface
- tags:
- - { name: cache.bin.memory, default_backend: cache.backend.memory.memory }
- factory: ['@cache_factory', 'get']
- arguments: [jsonapi_memory]
-
- # A chained cache with an in-memory cache as the first layer and a database-
- # backed cache as the fallback is used. The first layer (memory) is necessary
- # because ResourceType value objects are retrieved many times during a
- # request. The second layer (by default a database) is necessary to avoid
- # recomputing the ResourceType value objects on every request.
- cache.jsonapi_resource_types:
- class: Drupal\Core\Cache\BackendChain
- calls:
- - [appendBackend, ['@cache.jsonapi_memory']]
- - [appendBackend, ['@cache.default']]
- tags: [{ name: cache.bin.memory }]
- cache.jsonapi_normalizations:
- class: Drupal\Core\Cache\CacheBackendInterface
- tags:
- - { name: cache.bin }
- factory: ['@cache_factory', 'get']
- arguments: [jsonapi_normalizations]
- variation_cache.jsonapi_normalizations:
- class: Drupal\Core\Cache\VariationCacheInterface
- factory: ['@variation_cache_factory', 'get']
- arguments: [jsonapi_normalizations]
-
- # Route filter.
- jsonapi.route_filter.format_setter:
- class: Drupal\jsonapi\Routing\EarlyFormatSetter
- tags:
- # Set to a high priority so it runs before content_type_header_matcher
- # and other filters that might throw exceptions.
- - { name: route_filter, priority: 100 }
-
- # Access Control
- jsonapi.entity_access_checker:
- class: Drupal\jsonapi\Access\EntityAccessChecker
- public: false
- arguments: ['@jsonapi.resource_type.repository', '@router.no_access_checks', '@current_user', '@entity.repository']
- calls:
- # This is a temporary measure. JSON:API should not need to be aware of the Content Moderation module.
- - [setLatestRevisionCheck, ['@?access_check.latest_revision']] # This is only injected when the service is available.
- Drupal\jsonapi\Access\EntityAccessChecker: '@jsonapi.entity_access_checker'
- access_check.jsonapi.relationship_route_access:
- class: Drupal\jsonapi\Access\RelationshipRouteAccessCheck
- arguments: ['@jsonapi.entity_access_checker']
- tags:
- - { name: access_check, applies_to: _jsonapi_relationship_route_access }
-
- # Route filters.
- method_filter.jsonapi:
- public: false
- class: Drupal\jsonapi\Routing\ReadOnlyModeMethodFilter
- decorates: method_filter
- arguments: ['@method_filter.jsonapi.inner', '@config.factory']
-
- # Controller.
- jsonapi.entity_resource:
- class: Drupal\jsonapi\Controller\EntityResource
- arguments:
- - '@entity_type.manager'
- - '@entity_field.manager'
- - '@jsonapi.resource_type.repository'
- - '@renderer'
- - '@entity.repository'
- - '@jsonapi.include_resolver'
- - '@jsonapi.entity_access_checker'
- - '@jsonapi.field_resolver'
- - '@jsonapi.serializer'
- - '@datetime.time'
- - '@current_user'
- Drupal\jsonapi\Controller\EntityResource: '@jsonapi.entity_resource'
- jsonapi.file_upload:
- class: Drupal\jsonapi\Controller\FileUpload
- arguments:
- - '@current_user'
- - '@entity_field.manager'
- - '@file.upload_handler'
- - '@http_kernel'
- - '@file.input_stream_file_writer'
- - '@file_system'
- Drupal\jsonapi\Controller\FileUpload: '@jsonapi.file_upload'
-
- # Event subscribers.
- jsonapi.custom_query_parameter_names_validator.subscriber:
- class: Drupal\jsonapi\EventSubscriber\JsonApiRequestValidator
- jsonapi.resource_response.subscriber:
- class: Drupal\jsonapi\EventSubscriber\ResourceResponseSubscriber
- arguments: ['@jsonapi.serializer']
- jsonapi.resource_response_validator.subscriber:
- class: Drupal\jsonapi\EventSubscriber\ResourceResponseValidator
- arguments: ['@logger.channel.jsonapi', '@module_handler', '%app.root%']
- calls:
- - [setValidator, []]
- jsonapi.maintenance_mode_subscriber:
- class: Drupal\jsonapi\EventSubscriber\JsonapiMaintenanceModeSubscriber
- arguments: ['@maintenance_mode', '@config.factory']
-
- # Revision management.
- jsonapi.version_negotiator:
- class: Drupal\jsonapi\Revisions\VersionNegotiator
- public: false
- tags:
- - { name: service_collector, tag: jsonapi_version_negotiator, call: addVersionNegotiator }
- Drupal\jsonapi\Revisions\VersionNegotiator: '@jsonapi.version_negotiator'
- jsonapi.version_negotiator.default:
- arguments: ['@entity_type.manager']
- public: false
- abstract: true
- jsonapi.version_negotiator.id:
- class: Drupal\jsonapi\Revisions\VersionById
- parent: jsonapi.version_negotiator.default
- tags:
- - { name: jsonapi_version_negotiator, negotiator_name: 'id' }
- jsonapi.version_negotiator.rel:
- class: Drupal\jsonapi\Revisions\VersionByRel
- parent: jsonapi.version_negotiator.default
- tags:
- - { name: jsonapi_version_negotiator, negotiator_name: 'rel' }
- jsonapi.resource_version.route_enhancer:
- class: Drupal\jsonapi\Revisions\ResourceVersionRouteEnhancer
- public: false
- arguments:
- - '@jsonapi.version_negotiator'
- tags:
- - { name: route_enhancer }
Services
Title | Deprecated | Summary |
---|---|---|
access_check.jsonapi.relationship_route_access | Drupal\jsonapi\Access\RelationshipRouteAccessCheck | |
cache.jsonapi_memory | Drupal\Core\Cache\MemoryCache\MemoryCacheInterface | |
cache.jsonapi_normalizations | Drupal\Core\Cache\CacheBackendInterface | |
cache.jsonapi_resource_types | Drupal\Core\Cache\BackendChain | |
Drupal\jsonapi\Access\EntityAccessChecker | ||
Drupal\jsonapi\Context\FieldResolver | ||
Drupal\jsonapi\Controller\EntityResource | ||
Drupal\jsonapi\Controller\FileUpload | ||
Drupal\jsonapi\IncludeResolver | ||
Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface | ||
Drupal\jsonapi\Revisions\VersionNegotiator | ||
jsonapi.custom_query_parameter_names_validator.subscriber | Drupal\jsonapi\EventSubscriber\JsonApiRequestValidator | |
jsonapi.entity_access_checker | Drupal\jsonapi\Access\EntityAccessChecker | |
jsonapi.entity_resource | Drupal\jsonapi\Controller\EntityResource | |
jsonapi.exception_subscriber | Drupal\jsonapi\EventSubscriber\DefaultExceptionSubscriber | |
jsonapi.field_resolver | Drupal\jsonapi\Context\FieldResolver | |
jsonapi.file_upload | Drupal\jsonapi\Controller\FileUpload | |
jsonapi.include_resolver | Drupal\jsonapi\IncludeResolver | |
jsonapi.maintenance_mode_subscriber | Drupal\jsonapi\EventSubscriber\JsonapiMaintenanceModeSubscriber | |
jsonapi.normalization_cacher | Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher | |
jsonapi.resource_response.subscriber | Drupal\jsonapi\EventSubscriber\ResourceResponseSubscriber | |
jsonapi.resource_response_validator.subscriber | Drupal\jsonapi\EventSubscriber\ResourceResponseValidator | |
jsonapi.resource_type.repository | Drupal\jsonapi\ResourceType\ResourceTypeRepository | |
jsonapi.resource_version.route_enhancer | Drupal\jsonapi\Revisions\ResourceVersionRouteEnhancer | |
jsonapi.route_enhancer | Drupal\jsonapi\Routing\RouteEnhancer | |
jsonapi.route_filter.format_setter | Drupal\jsonapi\Routing\EarlyFormatSetter | |
jsonapi.serializer | Drupal\jsonapi\Serializer\Serializer | |
jsonapi.version_negotiator | Drupal\jsonapi\Revisions\VersionNegotiator | |
jsonapi.version_negotiator.default | Abstract | |
jsonapi.version_negotiator.id | Drupal\jsonapi\Revisions\VersionById | |
jsonapi.version_negotiator.rel | Drupal\jsonapi\Revisions\VersionByRel | |
logger.channel.jsonapi | ||
method_filter.jsonapi | Drupal\jsonapi\Routing\ReadOnlyModeMethodFilter | |
paramconverter.jsonapi.entity_uuid | Drupal\jsonapi\ParamConverter\EntityUuidConverter | |
paramconverter.jsonapi.resource_type | Drupal\jsonapi\ParamConverter\ResourceTypeConverter | |
serializer.encoder.jsonapi | Drupal\jsonapi\Encoder\JsonEncoder | |
serializer.normalizer.config_entity.jsonapi | Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer | |
serializer.normalizer.content_entity.jsonapi | Drupal\jsonapi\Normalizer\ContentEntityDenormalizer | |
serializer.normalizer.data.jsonapi | Drupal\jsonapi\Normalizer\DataNormalizer | |
serializer.normalizer.entity_access_exception.jsonapi | Drupal\jsonapi\Normalizer\EntityAccessDeniedHttpExceptionNormalizer | |
serializer.normalizer.field.jsonapi | Drupal\jsonapi\Normalizer\FieldNormalizer | |
serializer.normalizer.field_item.jsonapi | Drupal\jsonapi\Normalizer\FieldItemNormalizer | |
serializer.normalizer.http_exception.jsonapi | Drupal\jsonapi\Normalizer\HttpExceptionNormalizer | |
serializer.normalizer.jsonapi_document_toplevel.jsonapi | Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer | |
serializer.normalizer.link_collection.jsonapi | Drupal\jsonapi\Normalizer\LinkCollectionNormalizer | |
serializer.normalizer.relationship.jsonapi | Drupal\jsonapi\Normalizer\RelationshipNormalizer | |
serializer.normalizer.resource_identifier.jsonapi | Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer | |
serializer.normalizer.resource_object.jsonapi | Drupal\jsonapi\Normalizer\ResourceObjectNormalizer | |
serializer.normalizer.unprocessable_entity_exception.jsonapi | Drupal\jsonapi\Normalizer\UnprocessableHttpEntityExceptionNormalizer | |
variation_cache.jsonapi_normalizations | Drupal\Core\Cache\VariationCacheInterface |
Pagination
- Page 1
- Next page
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.