All exportable configuration is defined by a schema. For example, basic information about the site, including the name, email address, slogan, and so on are exported to a system.site.yml file. This is defined by system.schema.yml in core/modules/system/config/schema. It contains the definition of the exports, such as the following:
system.site:
type: config_object
label: 'Site information'
mapping:
uuid:
type: string
label: 'Site UUID'
name:
type: label
label: 'Site name'
mail:
type: email
label: 'Email address'
[...]
These schemas are used for the following reasons:
- To identify translatable strings that can be discovered by localize.drupal.org
- To discover labels and other properties when translating configuration
- To describe the actual information being stored in the exported configuration and to ensure it can be validated
- To allow automatic typecasting of values to ensure that only actual changes are shown rather than changes in type
When developing a new custom module, you can use drupal.org/project/config_inspector to help debug your schema as well as to test any custom exports.
Each element of the schema can have the following properties:
- type: The data type of the element
- label: The label shown on the interface
- translatable: Whether the configuration element can be translated
- nullable: Whether the value can be empty; the default is false
The data types supported in the schema are:
- Scalar values
- Mapping
- Sequence
- Reusable types
- Dynamic type references