Skip to content

@nogoo9/no-crd / index / parseSpecString

Function: parseSpecString()

parseSpecString(specStr): Record<string, unknown>

Defined in: src/k8s/local-templates.ts:37

Parses a spec string that may be JSON or YAML. Auto-detects: if the trimmed string starts with {, parses as JSON; otherwise parses as YAML. This is backward-compatible with existing JSON-only ConfigMap data.spec fields.

Parameters

specStr

string

Raw spec string from a ConfigMap or file.

Returns

Record<string, unknown>

Parsed object.

Throws

If the string cannot be parsed as either JSON or YAML.