Closed iliasmentz closed 9 months ago
I like the idea, but would remove or handle some data differently The team should talk about this in a meeting first
@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
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? On a real website this makes sense, but we only deliver test data, our filter criteria are very likely to be different from the actual website so users either have to map the filter criteria or just randomly assign their attributes to our names.
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?
Grilled steak with mashed potatoes and green salad
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 https://github.com/faker-js/faker/issues/1593#issuecomment-1379526156). Sure, it looses some consistency, but that is acceptable IMO.
just brainstorming. you could probably limit it initially to
faker.food.dish(type)
(type=dessert, main, drink) // returns {name, description}
faker.food.ingredients({min, max})
// returns an array with between min and max ingredients
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 faker.food.dish
and faker.food.dishDescription
and accept it will be inconsistent
that's a very interesting discussion 🙌
After working on ordering systems for a while, I would argue that if we are going to a more complex dataset that could be restaurant oriented, it would make more sense to have sides
(e.g. fries, rice, salad) and options
(rare, medium-rare, etc) instead of ingredients.
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:
Fruid-Salad" and lists it's ingredients as "Fish" and "Salt" and displays it as "Vegan"
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 food
is not accurate. Could be faker.restaurant.*
Thank you for your feature proposal.
We marked it as "waiting for user interest" for now to gather some feedback from our community:
If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.
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:
the number of votes (:+1:) and comments
the relevance for the ecosystem
availability of alternatives and workarounds
and the complexity of the requested feature
We do this because:
There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
Every feature we add to faker has "costs" associated to it:
I'd love this feature. I've collected a lot of data from Wikipedia on breads, fishes, fruits, pastas, veggies, potatoes, mangoes etc. If you'd like me to contribute - I'm down!
This Module got more then 5 upvotes! 🎉 Therefore we will accept and work on this module ❤️
This issue now has 10 upvotes on the top and 19 on this child comment https://github.com/faker-js/faker/issues/1593#issuecomment-1535827963 - 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
faker.food.dish()
could pick from a series of fake patterns like
'{{faker.food.cookingStyle}} {{faker.food.protein}} with {{faker.food.vegetable}}'
Which then gives you e.g. "fried chicken with broccoli" or "steamed tofu with spring onions"
I move this to the Anytime
milestone. We should discuss the API in the next meeting before starting to implement.
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
}
plain.string
refers to faker.helpers.arrayElement
fake.string
refers to faker.helpers.fake
If you have different suggestions please let us know.
ingedient -> ingredient ethnicCategory -> kitchenStyle/kitchenCategory (?) (food)Category (? https://wolt.com/en/discovery/restaurants)
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.
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 module