Contextuals
Here is a list of predefined generators retrieving values from Fabrication Context.
Context Accessor
Returns a value from the received context. The value is reached by the given path the value is expected to be at.
The configuration is a bit more complex for this type of generator. Its declaration looks like this:
This configuration tries to access the data provided externally
by the client, while accessing object person
and taking the property
email
. When for example you forget to provide the person, it won't struggle
with accessing proeprties of undefined
, it simply returns undefined
without error.
-
path
represents the path in the given fabrication context (likeprofiles.identifiers.uuid
) -
sep
represents separator to be used on path; by default it's a dot (.
); supported values are.
,/
,#
and$
-
handleError
tells the accessor that if there is no value on the path or when it comes into another issue, if it should try to handle or should fail in the first place. By default, it lets the error to be thrown. Otherwise, it uses null-like value specified inuseErrorValue
-
useErrorValue
value to be used when an error occurs (the recommended option is usingundefined
)