Skip to content
Draft
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
14 changes: 12 additions & 2 deletions e2e/config/test_schema_tombi
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ TOML
# placeholder values while running tombi through `mise x`.
cat >"$HOME/workdir/mise-age.toml" <<'TOML'
[env]
VALUE_OBJECT = { value = 123, tools = true, redact = true, required = "set VALUE_OBJECT" }
VALUE_OBJECT = { value = 123, tools = true, redact = true, required = false }
VALUE_DEFAULT = { default = 123, tools = true, redact = true }
REQUIRED_HELP = { required = "set REQUIRED_HELP", tools = true }
SECRET_SIMPLE = { age = "AGE-SECRET", tools = true }
SECRET_COMPLEX = { age = { value = "AGE-SECRET", format = "raw", tools = true, redact = true } }
TOML
Expand Down Expand Up @@ -229,7 +230,7 @@ strict = true

[[schemas]]
path = "file://$SCHEMA_PATH"
include = ["mise-bad.toml", "mise-bad-age.toml", "mise-bad-dotfiles.toml", "mise-bad-env-default.toml", "mise-bad-env-directive.toml", "mise-bad-env-float.toml", "mise-bad-install-env-float.toml", "mise-bad-minimum-release-age-array.toml", "mise-bad-minimum-release-age-table.toml", "mise-bad-package-state.toml", "mise-bad-postinstall.toml", "mise-bad-vars.toml", "mise-bad-tmpl.toml", "mise-bad-tmpl-output-flag.toml", "mise-bad-os.toml", "mise-bad-watch-files.toml", "mise-bad-launchd-calendar.toml", "mise-bad-launchd-queue.toml", "mise-bad-launchd-throttle.toml", "mise-bad-systemd.toml", "mise-bad-oci-copy.toml", "mise-bad-shell-activate.toml"]
include = ["mise-bad.toml", "mise-bad-age.toml", "mise-bad-dotfiles.toml", "mise-bad-env-default.toml", "mise-bad-env-directive.toml", "mise-bad-env-required.toml", "mise-bad-env-float.toml", "mise-bad-install-env-float.toml", "mise-bad-minimum-release-age-array.toml", "mise-bad-minimum-release-age-table.toml", "mise-bad-package-state.toml", "mise-bad-postinstall.toml", "mise-bad-vars.toml", "mise-bad-tmpl.toml", "mise-bad-tmpl-output-flag.toml", "mise-bad-os.toml", "mise-bad-watch-files.toml", "mise-bad-launchd-calendar.toml", "mise-bad-launchd-queue.toml", "mise-bad-launchd-throttle.toml", "mise-bad-systemd.toml", "mise-bad-oci-copy.toml", "mise-bad-shell-activate.toml"]

[[schemas]]
path = "file://$TASK_SCHEMA_PATH"
Expand Down Expand Up @@ -363,6 +364,15 @@ TOML

assert_fail "$TOMBI_LINT mise-bad-vars.toml"

# A concrete value may opt out of required validation, but it cannot also be
# marked as required.
cat >"$HOME/workdir/mise-bad-env-required.toml" <<'TOML'
[env]
VALUE_AND_REQUIRED = { value = "x", required = true }
TOML

assert_fail "$TOMBI_LINT mise-bad-env-required.toml"

# Verify that extends is rejected on task_templates (not supported at runtime)
cat >"$HOME/workdir/mise-bad-tmpl.toml" <<'TOML'
[task_templates.derived]
Expand Down
39 changes: 24 additions & 15 deletions schema/mise-task.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions schema/mise.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"description": "require this environment variable with user help text on how to set it"
}
],
"description": "require this environment variable to be defined before mise runs or in a later config file. Cannot be used with empty string values or value=false. Can be a boolean or a help string."
"description": "require this environment variable to be defined before mise runs or in a later config file. Can be a boolean or a help string. A variable that carries its own `value` cannot also be `required = true`."
},
"env_default": {
"oneOf": [
Expand Down Expand Up @@ -242,7 +242,8 @@
"$ref": "#/$defs/env_redact"
},
"required": {
"$ref": "#/$defs/env_required"
"const": false,
"description": "cannot be required when a value is provided; only `required = false` is accepted"
}
},
"required": ["value"],
Expand Down Expand Up @@ -274,7 +275,15 @@
"$ref": "#/$defs/env_redact"
},
"required": {
"$ref": "#/$defs/env_required"
"oneOf": [
{
"const": true
},
{
"type": "string"
}
],
"description": "a variable without a value must be required: `true` or a help string on how to set it"
}
},
"required": ["required"],
Expand Down
Loading