faker icon indicating copy to clipboard operation
faker copied to clipboard

Consideration about keep tag

Open pioz opened this issue 5 years ago • 1 comments

I love faker and I use it a lot on my tests. Something like this:

type User struct {
	Id        uint64 `faker:"-"`
	Email     string 
	Username  string
	FirstName string 
	LastName  string
}

user := User{Username: "John"}
faker.FakeData(&user) // I want all fake data except for `Username` because it was set manually

In practice, I want the faker:"keep" tag always. I don't know if also other users have this need. But for me, the keep tag should be the default behavior. This is also the default behavior for gems like FactoryBot for Ruby. So what I propose is to remove the keep tag and add a new one with the opposite effect, something like replace. Or a global configuration (faker.EnableKeepDefaultBehaviour())

What do you think guys?

pioz avatar Jun 27 '20 09:06 pioz

Is using the ignore tag is not enough? Hmm...

it'll take time to investigate this, I wonder if you have time, you can do it first.

bxcodec avatar Oct 09 '20 09:10 bxcodec