parseYAMLConfig
constparseYAMLConfig: (yaml) =>any
Defined in: packages/core/src/parser/yaml-parser.ts:1642
/**
- Convenience function to parse YAML config
Parse YAML string and validate against schema
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
yaml | string | YAML string to parse |
Returns
Section titled “Returns”any
Validated configuration object
Throws
Section titled “Throws”If YAML syntax is invalid
Throws
Section titled “Throws”If validation fails
Remarks
Section titled “Remarks”This method parses the YAML, validates it against the RootSchema, resolves all references, and returns the validated config. If any step fails, it throws an error.
Example
Section titled “Example”try { const config = YAMLParser.parse(yamlString); console.log('Valid config:', config);} catch (error) { console.error('Parse error:', error.message);}yaml
YAML string to parse *
Returns
Section titled “Returns”Validated configuration object *
Throws
Section titled “Throws”If parsing or validation fails * *
Remarks
Section titled “Remarks”- This is an alias for YAMLParser.parse for convenient imports.
Example
Section titled “Example”-
- import { parseYAMLConfig } from ‘@maplibre-yaml/core/parser’;
- const config = parseYAMLConfig(yamlString);
-