I am trying to find a way to make a schema that has a JSON array in it, but the elements of the array have different fields.
In the example bellow I have a field called definitions which will be the JSON array of objects defined. These objects could be either a person or a company. The problem I have encountered on this is finding a way to add a person and an company without the person and company having all of the same fields. I am not sure how I can do this in Mockaroo, but please let me know if you have any ideas.
What I want:
"definitions": [
{
"type":"person",
"givenName":"John",
"surname":"Smith"
},
{
"type":"company",
"companyName":"Minyx",
"typeofBusiness":"Health"
}
]
What I have:
"definitions": [
{
"type":"person",
"givenName":"John",
"surname":"Smith",
"companyName":"Minyx",
"typeofBusiness":"Health"
},
{
"type":"company",
"givenName":"Jane",
"surname":"Doe",
"companyName":"Yodoo",
"typeofBusiness":"Automotive"
}
]