@@ -161,9 +161,9 @@ level keys.
161161 future evolution of the schema while maintaining backward compatibility. This
162162 version string should be parsed and validated using the ` semver ` crate.[ ^ 4 ]
163163
164- - ` vars ` : A mapping of global key-value string pairs. These variables are
165- available for substitution in rule commands and target definitions and are
166- exposed to the Jinja templating context .
164+ - ` vars ` : A mapping of global key-value pairs. Keys must be strings. Values may
165+ be strings, numbers, booleans, or sequences. These variables seed the Jinja
166+ templating context and drive control flow within the manifest .
167167
168168- ` macros ` : An optional list of Jinja macro definitions. Each item provides a
169169 ` signature ` string using standard Jinja syntax and a ` body ` declared with the
@@ -414,7 +414,7 @@ pub struct NetsukeManifest {
414414 pub netsuke_version: Version,
415415
416416 #[serde(default)]
417- pub vars: HashMap<String, String >,
417+ pub vars: HashMap<String, serde_yml::Value >,
418418
419419 #[serde(default)]
420420 pub rules: Vec<Rule>,
@@ -466,7 +466,7 @@ pub struct Target {
466466 pub order_only_deps: StringOrList,
467467
468468 #[serde(default)]
469- pub vars: HashMap<String, String >,
469+ pub vars: HashMap<String, serde_yml::Value >,
470470
471471 /// Run this target when requested even if a file with the same name exists.
472472 #[serde(default)]
@@ -585,15 +585,14 @@ Unknown fields are rejected to surface user errors early. `StringOrList`
585585provides a default `Empty` variant, so optional lists are trivial to represent.
586586The manifest version is parsed using the `semver` crate to validate that it
587587follows semantic versioning rules. Global and target variable maps now share
588- the `HashMap<String, String>` type for consistency. This keeps YAML manifests
589- concise while ensuring forward compatibility. Targets also accept optional
590- ` phony` and `always` booleans. They default to `false`, making it explicit when
591- an action should run regardless of file timestamps. Targets listed in the
592- ` actions` section are deserialised using a custom helper so they are always
593- treated as `phony` tasks. This ensures preparation actions never generate build
594- artefacts. Convenience functions in `src/manifest.rs` load a manifest from a
595- string or a file path, returning `anyhow::Result` for straightforward error
596- handling.
588+ the `HashMap<String, serde_yml::Value>` type so booleans and sequences are
589+ preserved for Jinja control flow. Targets also accept optional `phony` and
590+ ` always` booleans. They default to `false`, making it explicit when an action
591+ should run regardless of file timestamps. Targets listed in the `actions`
592+ section are deserialised using a custom helper so they are always treated as
593+ ` phony` tasks. This ensures preparation actions never generate build artefacts.
594+ Convenience functions in `src/manifest.rs` load a manifest from a string or a
595+ file path, returning `anyhow::Result` for straightforward error handling.
597596
598597# ## 3.5 Testing
599598
@@ -666,6 +665,13 @@ lenient undefined behaviour. The resulting YAML is parsed to obtain the global
666665variables, which are then injected into the environment before a second, strict
667666render pass produces the final manifest for deserialisation.
668667
668+ The parser copies `vars` values into the environment using
669+ ` Value::from_serializable` . This preserves native YAML types so Jinja's
670+ ` {% if %}` and `{% for %}` constructs can branch on booleans or iterate over
671+ sequences. Keys must be strings; any non-string key causes manifest parsing to
672+ fail. Attempting to iterate over a non-sequence results in a render error
673+ surfaced during manifest loading.
674+
669675# ## 4.3 User-Defined Macros
670676
671677Netsuke allows users to declare reusable Jinja macros directly in the manifest.
0 commit comments