Open sobolevn opened 3 weeks ago
Let's say I have this typed dict:
class User(TypedDict): email: str password: str
I would love to just pass this metadata to mimesis to get my random data without any code duplication. Example of API that I am thinking of:
mimesis
mf = Field(locale=Locale.RU) schema = Schema(iterations=1, typed_dict_provider=User, schema=lambda: { # Customization is still fine: 'email': mf( 'person.email', domains=settings.TRUSTED_DOMAINS, ), })
So, this will:
password
email
This feature seems to be very useful. It would be great to have such a feature in Mimesis.
I think I may try to work on it this weekend.
I think the difficulty here can only be with nested entities.
See https://polyfactory.litestar.dev/reference/factories/typed_dict_factory.html
Let's say I have this typed dict:
I would love to just pass this metadata to
mimesis
to get my random data without any code duplication. Example of API that I am thinking of:So, this will:
password
as a text, with no modificationsemail
with a given modification