Configure documentation areas to filter routes
5.xThe areas configuration allows you to create multiple documentation sets by filtering routes based on different criteria. Each area can have its own documentation base, security schemes, and cache settings.
Area filtering options:
path_patterns: A list of regular expressions to match against the route path.host_patterns: A list of regular expressions to match against the route host.name_patterns: A list of regular expressions to match against the route name.with_attribute: Iftrue, only routes with the#[Areas]attribute are documented.disable_default_routes: Iftrue, disables default routes that do not have annotations/attributes.security: Defines security schemes (e.g., Bearer tokens) for the area.documentation: The base OpenAPI/Swagger documentation for this specific area.
nelmio_api_doc:
# ...
areas:
default:
path_patterns:
- '^/api'
host_patterns:
- '^api\.'
name_patterns:
- '^api_v1'
with_attribute: false
security:
MyBearerScheme:
type: 'http'
scheme: 'bearer'
disable_default_routes: false
documentation:
info:
title: 'My App'
description: 'My App Description'
cache:
pool: null
item_id: null