faker
faker copied to clipboard
Custom Tag Name
I am running currently into the following problem: I am trying to generate different fake data for different API endpoints, that revolve around the same data object, where the data object looks slightly different, depending from which endpoint it was created.
Example
type Data struct {
Source string `faker:"source"`
// ...
}
source
is a custom tag, that returns a hard-coded string like "Gateway"
or "InternalAPI"
. Since this string varies, I cannot easily generate custom fake data for all the sources. This would be solved if one could set the tag name when generating the data, ergo:
type Data struct {
Source string `faker_api:"source_api" faker_gateway:"source_gateway"`
// ...
}
The ability to set a custom tag name via the options.OptionFunc
would be ideal to solve this use-case.