Quantcast
Channel: Mockaroo Community Forum - Latest posts
Viewing all articles
Browse latest Browse all 2665

Creating a nested array of objects from a sample schema

$
0
0

Yes you can, using the new APIs feature. For example, you can create an API with the following handler script:

# Generate 10 users
schema "Users"
users = generate 10

# switch to the Groups schema
schema "Groups"
users.each do |user|
  user['blood_group'] = generate 1 # generate one group for each
end

users # return users as the result

Viewing all articles
Browse latest Browse all 2665

Latest Images

Trending Articles



Latest Images