diff --git a/mise.lock b/mise.lock index 0d4bf29752..30010e8d51 100644 --- a/mise.lock +++ b/mise.lock @@ -132,6 +132,10 @@ checksum = "sha256:a9fe3ea2f86dfc72f6728417521ec9067b343277152b114f4e98d8cb0e263 size = 841408 url = "https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-macos-arm64" +[[tools."npm:ajv-cli"]] +version = "5.0.0" +backend = "npm:ajv-cli" + [[tools."npm:markdownlint-cli"]] version = "0.45.0" backend = "npm:markdownlint-cli" diff --git a/mise.toml b/mise.toml index a4b1dc44a0..67dc08e7f0 100644 --- a/mise.toml +++ b/mise.toml @@ -21,6 +21,7 @@ hk = "latest" "jq" = "latest" "npm:markdownlint-cli" = "latest" "npm:prettier" = "3" +"npm:ajv-cli" = "latest" "pipx:toml-sort" = "latest" pkl = "latest" pre-commit = "latest" diff --git a/schema/mise-task.json b/schema/mise-task.json index bca8abe5e7..b7d58018eb 100644 --- a/schema/mise-task.json +++ b/schema/mise-task.json @@ -1,6 +1,6 @@ { "$id": "https://mise.jdx.dev/schema/mise-task.json", - "$schema": "https://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema#", "title": "mise-task-schema", "type": "object", "$defs": { diff --git a/schema/mise.json b/schema/mise.json index f192ff55f7..23449a1b77 100644 --- a/schema/mise.json +++ b/schema/mise.json @@ -272,6 +272,7 @@ "type": "boolean" }, "aqua": { + "type": "object", "additionalProperties": false, "properties": { "baked_registry": { @@ -339,6 +340,7 @@ "type": "string" }, "cargo": { + "type": "object", "additionalProperties": false, "properties": { "binstall": { @@ -419,6 +421,7 @@ } }, "dotnet": { + "type": "object", "additionalProperties": false, "properties": { "package_flags": { @@ -457,6 +460,7 @@ "type": "string" }, "erlang": { + "type": "object", "additionalProperties": false, "properties": { "compile": { @@ -606,6 +610,7 @@ "enum": ["trace", "debug", "info", "warn", "error"] }, "node": { + "type": "object", "additionalProperties": false, "properties": { "compile": { @@ -632,6 +637,7 @@ "type": "boolean" }, "npm": { + "type": "object", "additionalProperties": false, "properties": { "bun": { @@ -669,6 +675,7 @@ "type": "boolean" }, "pipx": { + "type": "object", "additionalProperties": false, "properties": { "registry_url": { @@ -697,6 +704,7 @@ "deprecated": true }, "python": { + "type": "object", "additionalProperties": false, "properties": { "compile": { @@ -815,6 +823,7 @@ "type": "boolean" }, "ruby": { + "type": "object", "additionalProperties": false, "properties": { "apply_patches": { @@ -855,6 +864,7 @@ } }, "rust": { + "type": "object", "additionalProperties": false, "properties": { "cargo_home": { @@ -876,6 +886,7 @@ "type": "boolean" }, "sops": { + "type": "object", "additionalProperties": false, "properties": { "age_key": { @@ -903,6 +914,7 @@ } }, "status": { + "type": "object", "additionalProperties": false, "properties": { "missing_tools": { @@ -926,6 +938,7 @@ } }, "swift": { + "type": "object", "additionalProperties": false, "properties": { "gpg_verify": { @@ -1428,6 +1441,7 @@ ] }, "install_env": { + "type": "object", "additionalProperties": { "oneOf": [ { @@ -1532,10 +1546,7 @@ "properties": { "run": { "type": "string", - "description": "script to run when file changes", - "items": { - "type": "string" - } + "description": "script to run when file changes" }, "patterns": { "type": "array", @@ -1647,6 +1658,7 @@ "$ref": "#/$defs/watch_files" }, "_": { + "type": "object", "additionalProperties": true } } diff --git a/schema/mise.plugin.json b/schema/mise.plugin.json index f57b551816..fa0e2f2832 100644 --- a/schema/mise.plugin.json +++ b/schema/mise.plugin.json @@ -30,6 +30,7 @@ }, "list-bin-paths": { "description": "configuration for bin/list-bin-paths script", + "type": "object", "additionalProperties": false, "properties": { "cache-key": { @@ -43,6 +44,7 @@ }, "exec-env": { "description": "configuration for bin/exec-env script", + "type": "object", "additionalProperties": false, "properties": { "cache-key": { diff --git a/tasks.md b/tasks.md index 8fae7237d7..37f76f583c 100644 --- a/tasks.md +++ b/tasks.md @@ -167,6 +167,12 @@ Lint Markdown files Lint using ripgrep +## `lint:schema` + +- **Usage**: `lint:schema` + +Lint schemas + ## `lint:toml` - **Usage**: `lint:toml` diff --git a/xtasks/lint/schema b/xtasks/lint/schema new file mode 100755 index 0000000000..6cb44a3666 --- /dev/null +++ b/xtasks/lint/schema @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +#MISE description="Lint schemas" +set -euo pipefail + +ajv compile -s schema/mise.json --spec=draft2019 --strict=true +ajv compile -s schema/mise-task.json --spec=draft2019 --strict=true +ajv compile -s schema/mise.plugin.json --spec=draft2020 --strict=true diff --git a/xtasks/render/settings.ts b/xtasks/render/settings.ts index 47023179c6..330f3cc91f 100644 --- a/xtasks/render/settings.ts +++ b/xtasks/render/settings.ts @@ -97,6 +97,7 @@ for (const key in doc) { } else { for (const subkey in props) { settings[key] = settings[key] || { + type: "object", additionalProperties: false, description: props.description, properties: {},