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.SynthesizeModelfor a singleBaseModel. Usesyntdata.base.SynthesizeSchemafor a schema with multiple, relatedBaseModel.The
syntdata.base.SynthesizeModelis an Iterator overBaseModelobjects. Thesyntdata.base.SynthesizeSchemacan emit Iterators overBaseModelobjects for each model in the schema.Serialize the objects. For noise-free, clean data, a model iterator produces Pydantic
pydantic.BaseModelinstances. For noisy data, a data iterator produces dictionaries that may raise an exception when used to created a py:class:pydantic.BaseModel instance.