yamlFilesLoader
yamlFilesLoader<
T
>(schema
,config
):LoaderReturn
<T
>
Defined in: packages/core/src/loaders.ts:140
Loads and parses YAML files from a directory, validating each file against a schema. Supports both .yaml and .yml file extensions. Each file is parsed as a single YAML document.
Type Parameters
Section titled “Type Parameters”T
extends AnyStruct
The schema type extending AnyStruct
Parameters
Section titled “Parameters”schema
Section titled “schema”T
Effect Schema used to validate and decode the YAML content
config
Section titled “config”Configuration object
folder
Section titled “folder”string
Path to the directory containing YAML files
Returns
Section titled “Returns”LoaderReturn
<T
>
A Stream of validated objects matching the schema type
Throws
Section titled “Throws”When no YAML files are found, parsing fails, or validation fails
Example
Section titled “Example”const ConfigSchema = Schema.Struct({ name: Schema.String, settings: Schema.Record(Schema.String, Schema.Unknown),});
const configs = yamlFilesLoader(ConfigSchema, { folder: './configs' });