Is your feature request related to a problem? Please describe.
It'd be nice to have a way to automatically generate an example yaml config file from a config schema to include in a project for future contributors. Not something necessary any time soon but would be a nice convenience.
Describe the solution you'd like
def generate_example_file(config_schema: ConfigSchema, path: Path = os.getcwd(), file_types: Optional[Set[str]]=None):
...
Generates an instance of the schema, then turns it into a dictionary with .dict() and dumps it into a file of each of the supplied file types (or all supported types if file_types is omitted) at the specified path. Example value precedence for each field would be the following:
- Default value
- Example value
- An example generated off of the type hints
Generating example values might get a little icky, but could be either unsupported initially or have minimal support, etc.
Is your feature request related to a problem? Please describe.
It'd be nice to have a way to automatically generate an example yaml config file from a config schema to include in a project for future contributors. Not something necessary any time soon but would be a nice convenience.
Describe the solution you'd like
Generates an instance of the schema, then turns it into a dictionary with
.dict()and dumps it into a file of each of the supplied file types (or all supported types iffile_typesis omitted) at the specified path. Example value precedence for each field would be the following:Generating example values might get a little icky, but could be either unsupported initially or have minimal support, etc.