The non-relational part of the produced entities.
The relational part of the produced entities. It tells the framework how entities should refer to each others.
A set of constraints to be applied on the produced values.
fc.entityGraph(
{ node: { id: fc.stringMatching(/^[A-Z][a-z]*$/) } },
{ node: { linkTo: { arity: 'many', type: 'node' } } },
)
But user can also requests the helper for other values of arity: '0-1' for an optional link, '1' for a compulsory one and 'many' as in the example above. The type field declares the kind of entity we want to target; In our case we only declared "node", so a "node" will have zero to many "node" accessible from the field "linkTo".
Generate values based on a schema. Produced values will automatically come with links between each others when requested to.
Declaring a directed graph using this helper could easily be achieved with something like: