Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/loader/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,8 @@ fn locked_metadata(

fn locked_variable(variable: v2::Variable) -> Result<locked::Variable> {
ensure!(
variable.required ^ variable.default.is_some(),
"must be `required` OR have a `default`"
variable.required ^ variable.default.is_some() ^ variable.allow_unset,
"must be `required` OR have a `default` OR set to `allow_unset`"
);
Ok(locked::Variable {
description: variable.description,
Expand Down
7 changes: 7 additions & 0 deletions crates/manifest/src/schema/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ pub struct Variable {
/// Learn more: https://spinframework.dev/variables#adding-variables-to-your-applications
#[serde(default, skip_serializing_if = "is_false")]
pub secret: bool,
/// If set, the variable may be unset.
///
/// Example: `allow_unset = true`
///
/// Learn more: https://spinframework.dev/variables#adding-variables-to-your-applications
#[serde(default, skip_serializing_if = "is_false")]
pub allow_unset: bool,
}

/// The file, package, or URL containing the component Wasm binary. This may be:
Expand Down
Loading