You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user, I want to easily extend the available mappers of the pydantic model attribute types, for example, if there is a class that has an attribute type not supported by pydantic-factories and involves third-party libraries like this case, the extension of the mappers should be done on the user side.
Right now to do this the user has to subclass ModelFactory, override the method and extend the base value. This has the downsides that:
As the returned value of get_provider_map is generated on the return statement, to override the method the user has to copy and paste the whole dictionary potentially being outdated on future pydantic-factories releases.
It's not documented how to do this.
It's not easy for the user to do all this.
What I'm proposing is that ModelFactory has an internal attribute settable by the user where she can define the additional mappers, for example to give support to FakeDateTime the user's code would be:
As a user, I want to easily extend the available mappers of the pydantic model attribute types, for example, if there is a class that has an attribute type not supported by
pydantic-factories
and involves third-party libraries like this case, the extension of the mappers should be done on the user side.Right now to do this the user has to subclass ModelFactory, override the method and extend the base value. This has the downsides that:
get_provider_map
is generated on thereturn
statement, to override the method the user has to copy and paste the whole dictionary potentially being outdated on futurepydantic-factories
releases.What I'm proposing is that
ModelFactory
has an internal attribute settable by the user where she can define the additional mappers, for example to give support toFakeDateTime
the user's code would be:We'll have to tweak
get_provider_map
so that it merges the default mapper dictionary with the user'sThe text was updated successfully, but these errors were encountered: