Skip to main content
The data pipeline configures how data objects are constructed from a payload. A normalized array is passed through multiple pipes that transform it into property values for the data object constructor.

Default Pipeline

The pipeline consists of these pipes by default:
  • AuthorizedDataPipe - Checks if the user is authorized to perform the request
  • MapPropertiesDataPipe - Maps property names
  • FillRouteParameterPropertiesDataPipe - Fills property values from route parameters
  • ValidatePropertiesDataPipe - Validates properties
  • DefaultValuesDataPipe - Adds default values for unset properties
  • CastPropertiesDataPipe - Casts property values

Customizing the Pipeline

Define a custom pipeline for a data object:

Creating a DataPipe

Implement the DataPipe interface:

Parameters

  • payload - The non-normalized payload
  • class - DataClass object for the data object (more info)
  • properties - Key-value properties for constructing the data object
  • creationContext - Context containing:
    • dataClass - The data class being created
    • validationStrategy - The validation strategy in use
    • mapPropertyNames - Whether property names should be mapped
    • disableMagicalCreation - Whether to use magical creation methods
    • ignoredMagicalMethods - Which magical methods are ignored
    • casts - Collection of global casts

Preparing Data for the Pipeline

Modify the payload after normalization but before entering the pipeline:
Now create a data object with a flat structure:

Extending the Pipeline

Add a pipe at the beginning without creating a whole new pipeline:

Pipeline and Magic Methods

When using magic creation methods, the pipeline is not used (since you manually control construction). Only when you pass a request object is a minimal version used for authorization and validation.