MCPcopy Index your code
hub / github.com/deepnote/deepnote / parseYaml

Function parseYaml

packages/blocks/src/deepnote-file/parse-yaml.ts:124–144  ·  view source on GitHub ↗
(yamlContent: string)

Source from the content-addressed store, hash-verified

122 * - Explicit typing enforced by schema
123 */
124export function parseYaml(yamlContent: string): unknown {
125 try {
126 // Validate no BOM prefix (string-level check only)
127 // Note: For proper UTF-8 validation, use decodeUtf8NoBom() on raw bytes before calling this
128 validateNoBomPrefix(yamlContent)
129
130 // Validate YAML structure (no anchors, aliases, merge keys, custom tags)
131 validateYamlStructure(yamlContent)
132
133 // Parse and validate in a single pass (checks duplicate keys and converts to JS)
134 const parsed = parseAndValidate(yamlContent)
135
136 return parsed
137 } catch (error) {
138 if (error instanceof DeepnoteError) {
139 throw error
140 }
141 const message = error instanceof Error ? error.message : String(error)
142 throw new ParseError(`Failed to parse Deepnote file: ${message}`, { cause: error })
143 }
144}

Callers 7

validateDeepnoteFileFunction · 0.90
parse-yaml.test.tsFile · 0.90
deserializeDeepnoteFileFunction · 0.90
handleValidateFunction · 0.90
parseIntegrationsFunction · 0.90
parseYamlFrontmatterFunction · 0.85

Calls 3

validateNoBomPrefixFunction · 0.85
validateYamlStructureFunction · 0.85
parseAndValidateFunction · 0.85

Tested by

no test coverage detected