MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / parseConfigYaml

Function parseConfigYaml

src/config/configuration/serializer.ts:16–45  ·  view source on GitHub ↗
(yamlString: string)

Source from the content-addressed store, hash-verified

14 * Parse a YAML configuration string and validate it.
15 */
16export function parseConfigYaml(yamlString: string): ConfigValidationResult {
17 try {
18 const parsed = YAML.load(yamlString);
19
20 if (parsed === null || parsed === undefined) {
21 return {
22 valid: false,
23 errors: [{ path: '', message: 'Empty configuration file' }],
24 config: null,
25 };
26 }
27
28 if (typeof parsed !== 'object') {
29 return {
30 valid: false,
31 errors: [{ path: '', message: 'Configuration must be an object' }],
32 config: null,
33 };
34 }
35
36 return validateConfiguration(snakeToCamel(parsed));
37 } catch (err) {
38 const message = err instanceof Error ? err.message : 'Unknown YAML parse error';
39 return {
40 valid: false,
41 errors: [{ path: '', message: `YAML parse error: ${message}` }],
42 config: null,
43 };
44 }
45}
46
47/**
48 * Serialize a configuration object to YAML format.

Callers 1

serializer.test.tsFile · 0.90

Calls 2

validateConfigurationFunction · 0.90
snakeToCamelFunction · 0.90

Tested by

no test coverage detected