Recipe YAML Schema
When to Use
Every recipe requires a
recipe.ymlfile defining metadata, dependencies, extensions, configuration, inputs, and content.
Items: recipe.yml Keys
name
Type: string (required)
Description: Human-readable recipe name
Validation: Cannot span multiple lines or contain control characters
Usage Example:
name: 'Standard'
description
Type: string (optional)
Description: Short description of the recipe
Validation: Cannot contain control characters except tabs, newlines, carriage returns
Usage Example:
description: 'Provides a standard site with commonly used features pre-configured.'
type
Type: string (optional)
Description: Recipe category for organizational purposes
Validation: Cannot span multiple lines or contain control characters
Usage Example:
type: 'Site'
recipes
Type: array (optional)
Description: List of recipe machine names to apply before this recipe
Validation: Each recipe must exist and cannot depend on itself
Usage Example:
recipes:
- basic_block_type
- article_content_type
install
Type: array (optional)
Description: List of module/theme machine names to install
Validation: Each extension must be available (discovered by extension discovery)
Usage Example:
install:
- image
- node
- path
config
Type: associative_array (optional)
Description: Configuration to import and config actions to apply
Sub-keys: import, strict, actions
Usage Example:
config:
strict: true
import:
node:
- views.view.content
actions:
user.role.authenticated:
grantPermission: 'access content'
input
Type: associative_array (optional)
Description: Defines user-provided values for the recipe
Keys: Input name → input definition
Usage Example:
input:
site_name:
description: 'The name of the site'
data_type: string
default:
source: config
config: [system.site, name]
${input_name} syntax
content
Type: array (optional, reserved for future use)
Description: Reserved for default content configuration
Usage Example:
content: []
content/ directory; this key is validated but not actively used
extra
Type: associative_array (optional)
Description: Extension-specific data keyed by extension name
Validation: Keys must be valid extension names
Usage Example:
extra:
my_module:
custom_setting: value
Recipe::getExtra()
Common Mistakes
- Omitting
name→ Required field, validation fails without it - Using relative paths in recipes list → Recipe names are machine names, not paths
- Listing themes before modules in install → Themes depend on modules; runner handles order automatically but explicit theme-before-module breaks
- Misspelling config action keys → Actions silently fail if plugin ID doesn't exist
- Forgetting to install extensions that provide config being imported → Validation catches this for config actions, not always for imports
See Also
- Previous: ← Recipe System Overview
- Next: Creating Your First Recipe →
- Reference:
core/lib/Drupal/Core/Recipe/Recipe.php(parse method, validation constraints)