Context Accessing Shortcut
To simplify the context accessing and its definition, there's a shortcut notation defined. This type of declaration was chosen to enable simplicity of the schema definition based on more dynamic schema compilation approach.
Instead of somewhat statically typed names of standards, this approach lets you pass configuration as a part of the name to your Field declaration.
This notation is based on two parts - !ref-<<path>>
, where the <<path>>
is the path in the
given context object using dots (.
) as separators.
Example
In this example, you can see how you can access the desired value by specifying the path through the Fabrication Context object.
Here's a full demonstration of how the shortcut can be used:
Example
You can declare your schema with usage of identifiers profile. This profile passes pregenerated values into a context object accessible to each value generator, so you can easily access it.
You can also specify other fields; in this case addressId
field - to take a value from given
context object passed during the fabrication. This can be useful for example when you are generating
instances of multiple entities linked by foreign keys.