#Contextual reference this and parent
The power of your schema lies in its ability to reference other parts of the data structure. You have two contextual references available:
<this.
: Allows you to access values within the nearest object context.
<parent.
: Grants access to values in the entire generated schema.
#Usage
#<this.
In your schema, <this.nested.object>
references the nested.object field within the same object. This lets you reuse values within the same object. For example:
This will generate:
#<parent.
The <parent.
reference allows you to access values from other parts of the generated schema. For instance:
This will generate:
Using schemas for dynamic data generation with contextual references like <this.
and <parent.
provides powerful flexibility. You can create complex data structures with interdependencies, making it easier to simulate real-world scenarios in your testing or development processes. Understanding how to leverage these references effectively will enable you to generate diverse and realistic data effortlessly.