Closed adhtruong closed 4 months ago
In what scenarios would a user need to do this? Also, couldn't the user just do this directly by specifying a classmethod like in the following:
@dataclass
class Foo:
foo: int
class FooFactory(DataclassFactory[Foo]):
@classmethod
def foo(cls) -> int:
# Create the value with whatever constraints they may need.
# They could use the same API that you've used in this PR if they want.
Hi @guacs , thanks for review. Definitely needs cleaning up and adding docs and handling for coverage before merging.
My idea mentioned here is making constraints more easy to do. It may be preferable to do it this way so the constraints are handled by the library itself rather than manually specifying. May not be worth the added complexity here as there is an existing way to do this
Yeah my initial instinct is to hold off on this since it's something the user can do themself and not a very common issue I assume.
Hold off for now as workaround for functionality.
Pull Request Checklist
Description
Close Issue(s)