Working with data buckets and "new" data #1353
Unanswered
joshua-webdev
asked this question in
Help
Replies: 1 comment
-
Hi, There is currently no relations between data buckets. You can compose data buckets content like you did, but once generated the link is not maintained. Which means that if you update a data bucket using a CRUD endpoint, no other data bucket will get updated. And indeed, if you put the parent template in a regular body, it will get generated for every request, which is probably not what you want to achieve. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I may be misunderstanding how Mockoon is meant to be used, so I'd like to clarify something.
Let's say I want to pre-populate some fake records; a data bucket seems like the perfect tool, so I set up a bucket with an array of 20 repeated items. Now, one of the object fields is an array pointing to another data bucket and this other data bucket is connected to a CRUD endpoint so I can create new records.
After playing around with it, I came to understand that data buckets just populate once. My "child items" bucket starts out empty and anything I add to it "at runtime" won't show up in that
items
array, because at the time the parent bucket is created, the child bucket was empty. Later calls to my endpoint that returns data from the parent bucket will never return the updateditems
.I saw in another discussion that if I want Mockoon to work like this, then I should define these parent items as a regular body instead of a data bucket. If I do so, won't I lose persistence (i.e. the parent item would be regenerated each time with new faker data)?
Am I trying to use Mockoon for something it's not meant to do? I think I could possibly make my parent bucket start out empty, but then I would have to pre-populate it by making API calls instead of just defining a loop of 20 items in the data bucket, no?
Beta Was this translation helpful? Give feedback.
All reactions