Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto generation inspector feature #822

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

arthurHamon2
Copy link

@arthurHamon2 arthurHamon2 commented Nov 23, 2020

Related to this (old) issue : #277

The idea is to have a generic model that allows to auto generate factory's fields based on the object declaration.
A complete description of the feature is coming with this PR in the following days.

The feature adds the following options:
- introspector_class: the class to use to map the model fields to factory attributes
- default_auto_fields: whether to generate the factory fields automatically or not.
- include_auto_fields: which fields should be included in the autogeneration.
- exclude_auto_fields: which fields the end user wants to generate by himself.
This class aims to:
- define how the field's type of a model is mapped to a declaration factory
- how to get the field names, to generate declaration automatically, of a model class
- how to build the factory declaration
It uses the introspector class linked in the meta option in
order to generate the right declarations related to the model fields.
Faker is used to match the right formatter related
to the field name.
@daramousk
Copy link

Hi there and thanks for this great library!

I'd like to ask about this PR, is this a WIP? Can I offer some assistance/contribution?

This definitely could be of use since I have models with dozens of basic fields that i'd like to not define them on every factory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants