UsageΒΆ
See Code for an example application to generate valid data.
The essence is this:
Define the applciation model using Pydantic.
Add details beyond the typical validation cases. This often means adding a distribution information in addition to valid choices or numeric ranges.
Use the
syntdata.base.SynthesizeModel
for a singleBaseModel
. Usesyntdata.base.SynthesizeSchema
for a schema with multiple, relatedBaseModel
.The
syntdata.base.SynthesizeModel
is an Iterator overBaseModel
objects. Thesyntdata.base.SynthesizeSchema
can emit Iterators overBaseModel
objects for each model in the schema.Serialize the objects. For noise-free, clean data, a model iterator produces Pydantic
pydantic.BaseModel
instances. For noisy data, a data iterator produces dictionaries that may raise an exception when used to created a py:class:pydantic.BaseModel instance.