detect_yaml_version

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

detect_yaml_version(payload: Mapping[str, Any]) → str[source]

Detect whether a YAML payload follows the v0 or v1 layout.

A payload is v1 when it carries an explicit version: "1.x" tag or the characteristic spec + (policy | data) section pair; every other mapping is treated as v0. Detection never raises on shape – it is a classifier, not a validator.

Parameters:

payload – Top-level YAML mapping.

Returns:

"v0" or "v1".