This module allows you to expose your Drupal configuration data to GraphQL. You can select specific configuration items and their fields to make available, and the module automatically handles the conversion to GraphQL types for type-safe querying.
GraphQL Compose Configs module extends GraphQL Compose to expose Drupal configuration through GraphQL, providing type-safe access to configuration data.
Features
Expose any Drupal configuration through GraphQL.
- Selectively choose which configuration fields to expose.
- Automatic type generation for exposed configurations.
- Integration with GraphQL Compose's schema system.
- Administrative interface for managing configuration exposure.
- Type-safe access to configuration data.
Post-Installation
After installing and enabling the module:
- Navigate to /admin/config/graphql/compose/configs.
- Click "Add configuration exposure".
- Select the configuration you want to expose.
- Choose which fields to expose.
- Save the configuration.
Additional Requirements
This module requires the following:
- Drupal 10.2 or later.
- GraphQL Compose module.
Usage
Exposing Configuration
Navigate to /admin/config/graphql/compose/configs.
- Click "Add configuration exposure".
- Select the configuration you want to expose.
- Choose which fields to expose.
- Save the configuration.
Querying Configuration
Once a configuration is exposed, you can query it using GraphQL. For example, to query the system.site configuration:
query {
systemSite {
name
mail
slogan
}
}
The module automatically converts configuration names to valid GraphQL type names (e.g., system.site becomes systemSite).
Permissions
The module defines the following permission:
- Administer GraphQL configuration exposure: Allows users to manage which configurations are exposed through GraphQL.
Community Documentation
For more detailed information and best practices, refer to the GraphQL Compose documentation.