Overlay Customizations
Overlays allow you to modify your gRPC specifications without directly editing the original Protocol Buffer files. This is useful for:
- Adding Fern-specific extensions
- Customizing SDK method and parameter names
- Adding examples and documentation
- Configuring audiences and filtering
Configure overlays
To use overlays, add them to your generators.yml
file:
Overlay file structure
Overlay files use Protocol Buffer text format with Fern extensions:
Add method names
Override SDK method names for better developer experience:
Add parameter names
Customize parameter names for better SDK ergonomics:
Add examples
Enhance your specification with comprehensive examples:
Filter with audiences
Add audience filtering to services and methods:
Add error handling
Configure custom error handling for methods:
Add documentation
Enhance descriptions and documentation:
Configure timeouts and retries
Add timeout and retry configurations:
Streaming configurations
Configure streaming methods:
Multiple overlays
You can apply multiple overlay files in sequence:
Environment-specific overlays
Use different overlays for different environments:
Field-level overlays
Apply overlays to specific message fields:
Validation overlays
Add validation rules to existing fields:
Overlays are applied in order, allowing you to build up customizations incrementally while keeping your original Protocol Buffer files clean and focused on the core service definition.