Skip to content

parseYAMLConfig

const parseYAMLConfig: (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

ParameterTypeDescription
yamlstringYAML string to parse

any

Validated configuration object

If YAML syntax is invalid

If validation fails

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.

try {
const config = YAMLParser.parse(yamlString);
console.log('Valid config:', config);
} catch (error) {
console.error('Parse error:', error.message);
}

yaml

YAML string to parse *

Validated configuration object *

If parsing or validation fails * *

  • import { parseYAMLConfig } from ‘@maplibre-yaml/core/parser’;
  • const config = parseYAMLConfig(yamlString);