0

I'm creating a temporary GraphQL backend, that should serve mocked data.

E.g. I need ~500 objects of the model Person (with firstName, lastName, email, country, etc), where the properties shouldn't change on each request.

Is there any library where it's possible to get fake data always created in the same order?

Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232

4 Answers4

1

Not sure if this is exactly what you want, but I discovered this site: https://crudpi.io/ this weekend, you can mock some data in a JSON file and use it for your API. I guess that it's limited to 100 objects or something, but if you need the same data, you can copy it 5 times I guess. Hope it helps!

I wish that I could write this as a comment but I don't have enough reputation yet.

danibrum
  • 459
  • 8
  • 21
1

Here's an API. https://uinames.com/api/?amount=500

You should easily just create a script, add the data you got from this to a temp-database.

Christian Moen
  • 1,253
  • 2
  • 17
  • 31
1

You can easily create your custom JSON with https://next.json-generator.com/ which allows using internal scripts for data generation

Here is an example of generating a list of names: https://next.json-generator.com/Vk95XL5mv

Sergey Mell
  • 7,780
  • 1
  • 26
  • 50
1

You can use a generator like https://randomuser.me/ Make a loop to create your object then keep the result in a file to ensure the data will be the same.

You can get an exemple here : https://gist.github.com/Yexan/cb8b79390e01272a4912fb4d6773ee1a

I used https://randomuser.me/api/?results=500