Variation Points
A variation point is a typed placeholder: an entity with its own permanent identity that says "in my place, something else should be". In the API it is called a variant (variant); in the source code it is also known as a ghost entity.
A variation point is an instance of the real type (for example a part). It stands where a real entity would stand:
- as the target of a relationship, or
- as an item of an owned list.
Its own properties and traits act as an eligibility spec: they describe which real entities may take its place. A variation point can additionally carry a match document -- an explicit search filter that the replacing entity must satisfy.
Characteristics
| Aspect | Behaviour |
|---|---|
| Creation | Through the normal create request with "variant": true and an explicit key |
| Reading | Variation points carry "@variant": true; real entities do not have the field |
| Validation | Variation points are exempt from required and unique checks |
| Listings and search | Variation points are hidden by default; include them with ?include_variants=true |
| Reuse | The variation point itself is never changed by instantiation and can be used in many templates |
Instantiating a Variation Point
POST …/@instantiate on an aggregate replaces the sites of the variation point -- relationship targets point at the real entity instead, list entries are swapped -- with a supplied real entity (the filler). The filler is checked against the eligibility spec of the variation point. The aggregate gets a new commit on the addressed branch; the filler keeps its own root_id, key, history and lifecycle.
GET …/@variants lists the variation point sites of an aggregate, as input for an instantiation. See the REST API Reference for the request formats.
Limitations (v1)
- Instantiation always replaces the sites in place. Producing a separate view or copy is not yet available.
- Variation points cannot stand in a component slot; creating one there is rejected.