Skip to content

Add from_typed_dict schema  #1579

@sobolevn

Description

@sobolevn

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:

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:

  • Generate password as a text, with no modifications
  • Generate email with a given modification

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions