-
-
Notifications
You must be signed in to change notification settings - Fork 975
Add food module on faker 🍽 #1593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I like the idea, but would remove or handle some data differently |
@iliasmentz Do you actually need it for your work/project, or is it just a feature request you consider useful? |
Thanks for following up @Shinigami92. We already use fakerjs in our project for test data but for now we have to use the commerce module result to a less realistic dataset. So the answer is yes 😄 |
@iliasmentz Which of the ruby faker food datasets/lists are useful to you and which not? |
Apologies for the delay @ST-DDT , I was off for a few days. From this, I would definitely use:
In the future, I could see myself also using:
the rest are less likely to be used (from me at least) as I feel the ingredients could cover them. they might be used for something particular but I can't really think of an actual use case right now. hope that helps 😅 |
I also had a recent need for a food (and drink) module. I would agree that dishes are most important. Might be good to seperate types of dish, like main courses, desserts, drinks. If we did dishes with descriptions then i'd prefer if you got back a {name, description} object rather than the description being completely unrelated to the name. http://menus.nypl.org/ has some good historical data which perhaps we could utilize. One thing i dont like about the Ruby data is the dish names are unrealistically simple/short, whereas in reality its common to have some longer dish names mixed in. thought this was quite interesting too! https://www.restaurant-website-builder.com/restaurant-menu-descriptions |
Dietary restrictions for each menu item could also be useful, e.g. Vegetarian, Gluten-free, Contains Nuts |
What is your usecase for that for test data? e.g. {
fruit-salat: {
containsNuts: true,
containsGluten: true,
containsLactose: true,
vegan: true,
vegentarian: false
}
} created via something like this: menu[faker.food.food()] = {
containsNuts: faker.datatype.boolean(),
containsGluten: faker.datatype.boolean(),
containsLactose: faker.datatype.boolean(),
vegan: faker.datatype.boolean(),
vegentarian: faker.datatype.boolean()
}; |
Testing CRM and POS for a restaurant |
I'm not sure what exactly you are referring to/hinting at.
I have no problem including the names of food (or names of ingredients), but I'm not so sure about including its ingredients or special properties of that food in it. There is a reason why we mostly abandoned complex return objects: The data structures that we have provided before differ from those that the user needs. The same applies to foods as well, so I would like to know an exact usecase for it. IMO if the UI shows a food-name as "Fruid-Salad" and lists it's ingredients as "Fish" and "Salt" and displays it as "Vegan", then that could be OK for testing purposes. If we provide these information as well, then what about a recipe website that need the actual quantities of those ingredients. Where do we stop with the data?
IMO it is not important whether these things are correct for testing purposes as long as the user can generate the data however they need it (e.g. like #1593 (comment)). Sure, it looses some consistency, but that is acceptable IMO. |
just brainstorming. you could probably limit it initially to
as you say other things are too menu-specific, and can be easily done with booleans (is is vegetarian) or ints (how many calories) |
or if you want to avoid returned objects completely then split |
that's a very interesting discussion 🙌 Ingredients focus more on storage management but as @ST-DDT said if we want a simple dataset both of them are not really that vital, we can build that on our end even if it looks like:
Finally regardless of what faker would offer, if I needed a custom logic for restrictions I would probably have them as an enum on my side instead of using faker's ones. |
also wondering what the module name should be, if it also includes say drinks then |
Thank you for your feature proposal. We marked it as "waiting for user interest" for now to gather some feedback from our community:
We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements. We will start the implementation based on:
We do this because:
|
I'd love this feature. |
This Module got more then 5 upvotes! 🎉 |
This issue now has 10 upvotes on the top and 19 on this child comment #1593 (comment) - can we consider working on this for 8.x? |
It would be nice if you have building blocks which allow for more creative dish names than just a hardcoded list, for example
Which then gives you e.g. "fried chicken with broccoli" or "steamed tofu with spring onions" |
I move this to the |
Team Decision We will start with a MVP: class FoodModule {
dish(): plain.string; // fried chicken
description(): fake.string; // Three eggs with cilantro, tomatoes, onions, avocados and melted Emmental cheese. With a side of roasted potatoes, and your choice of toast or croissant.
ingedient(): plain.string; // egg
ethnicCategory(): plain.string; // Italian
fruit(): plain.string; // apple
vegetable(): plain.string; // carrot
spice(): plain.string; // pepper
}
If you have different suggestions please let us know. |
ingedient -> ingredient |
I've created #2484 as an MVP for this. If you want to participate in designing the API please feel free to leave a comment on the PR. |
Uh oh!
There was an error while loading. Please reload this page.
Clear and concise description of the problem
As a developer using faker I want to be able to generate fake food data. That would allow food/restaurant-focused companies to create more accurate test environments faster.
Suggested solution
We could reuse the data from the original faker (ruby) library:
https://github.com/faker-ruby/faker/blob/main/lib/locales/en/food.yml
Alternative
No response
Additional context
I would be happy to attempt to pick this up, but in the
CONTRIBUTING.md
file it's a bit unclear how you can add a new moduleThe text was updated successfully, but these errors were encountered: