From 0488a80ace008d8f314f69347cc2d16f34067688 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Thu, 18 Jan 2024 09:29:48 -0600 Subject: [PATCH] fix: remove "versioning" from jsonschema defs This removes the "3" nested in `definitions` which makes the contents of `definitions` pass JSON Schema metaschema validation even when the contents are not valid subschemas. `definitions` SHOULD contain subschemas as its values, with no intermediate keys. (This is a MUST in later JSON Schema spec versions, in which the key switches from `definitions` to `$defs` as a related change.) The contents are intentionally *not* dedented to make review easier. --- docs/static/schema.json | 80 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/docs/static/schema.json b/docs/static/schema.json index b9d45292..c2085d27 100644 --- a/docs/static/schema.json +++ b/docs/static/schema.json @@ -3,9 +3,8 @@ "title": "Taskfile YAML Schema", "description": "Schema for Taskfile files.", "definitions": { - "3": { "env": { - "$ref": "#/definitions/3/vars" + "$ref": "#/definitions/vars" }, "tasks": { "type": "object", @@ -23,13 +22,13 @@ "type": "string" }, { - "$ref": "#/definitions/3/task_call" + "$ref": "#/definitions/task_call" } ] } }, { - "$ref": "#/definitions/3/task" + "$ref": "#/definitions/task" } ] } @@ -41,11 +40,11 @@ "properties": { "cmds": { "description": "A list of commands to be executed.", - "$ref": "#/definitions/3/cmds" + "$ref": "#/definitions/cmds" }, "cmd": { "description": "The command to be executed.", - "$ref": "#/definitions/3/cmd" + "$ref": "#/definitions/cmd" }, "deps": { "description": "A list of dependencies of this task. Tasks defined here will run in parallel before this task.", @@ -56,7 +55,7 @@ "type": "string" }, { - "$ref": "#/definitions/3/task_call" + "$ref": "#/definitions/task_call" } ] } @@ -88,14 +87,14 @@ "description": "A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs.", "type": "array", "items": { - "$ref": "#/definitions/3/glob" + "$ref": "#/definitions/glob" } }, "generates": { "description": "A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs.", "type": "array", "items": { - "$ref": "#/definitions/3/glob" + "$ref": "#/definitions/glob" } }, "status": { @@ -109,7 +108,7 @@ "description": "A list of commands to check if this task should run. If a condition is not met, the task will error.", "type": "array", "items": { - "$ref": "#/definitions/3/precondition" + "$ref": "#/definitions/precondition" } }, "dir": { @@ -120,23 +119,23 @@ "description": "Enables POSIX shell options for all of a task's commands. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html", "type": "array", "items": { - "$ref": "#/definitions/3/set" + "$ref": "#/definitions/set" } }, "shopt": { "description": "Enables Bash shell options for all of a task's commands. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html", "type": "array", "items": { - "$ref": "#/definitions/3/shopt" + "$ref": "#/definitions/shopt" } }, "vars": { "description": "A set of variables that can be used in the task.", - "$ref": "#/definitions/3/vars" + "$ref": "#/definitions/vars" }, "env": { "description": "A set of environment variables that will be made available to shell commands.", - "$ref": "#/definitions/3/env" + "$ref": "#/definitions/env" }, "dotenv": { "description": "A list of `.env` file paths to be parsed.", @@ -176,7 +175,7 @@ }, "run": { "description": "Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`.", - "$ref": "#/definitions/3/run" + "$ref": "#/definitions/run" }, "platforms": { "description": "Specifies which platforms the task should be run on.", @@ -187,7 +186,7 @@ }, "requires": { "description": "A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run", - "$ref": "#/definitions/3/requires_obj" + "$ref": "#/definitions/requires_obj" }, "watch": { "description": "Configures a task to run in watch mode automatically.", @@ -199,7 +198,7 @@ "cmds": { "type": "array", "items": { - "$ref": "#/definitions/3/cmd" + "$ref": "#/definitions/cmd" } }, "cmd": { @@ -208,16 +207,16 @@ "type": "string" }, { - "$ref": "#/definitions/3/cmd_call" + "$ref": "#/definitions/cmd_call" }, { - "$ref": "#/definitions/3/task_call" + "$ref": "#/definitions/task_call" }, { - "$ref": "#/definitions/3/defer_call" + "$ref": "#/definitions/defer_call" }, { - "$ref": "#/definitions/3/for_call" + "$ref": "#/definitions/for_call" } ] }, @@ -252,7 +251,7 @@ "type": ["boolean", "integer", "null", "number", "string", "object", "array"] }, { - "$ref": "#/definitions/3/var_subkey" + "$ref": "#/definitions/var_subkey" } ] } @@ -293,7 +292,7 @@ }, "vars": { "description": "Values passed to the task called", - "$ref": "#/definitions/3/vars" + "$ref": "#/definitions/vars" }, "silent": { "description": "Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`.", @@ -318,14 +317,14 @@ "description": "Enables POSIX shell options for this command. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html", "type": "array", "items": { - "$ref": "#/definitions/3/set" + "$ref": "#/definitions/set" } }, "shopt": { "description": "Enables Bash shell options for this command. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html", "type": "array", "items": { - "$ref": "#/definitions/3/shopt" + "$ref": "#/definitions/shopt" } }, "ignore_error": { @@ -372,13 +371,13 @@ "for": { "anyOf": [ { - "$ref": "#/definitions/3/for_list" + "$ref": "#/definitions/for_list" }, { - "$ref": "#/definitions/3/for_attribute" + "$ref": "#/definitions/for_attribute" }, { - "$ref": "#/definitions/3/for_var" + "$ref": "#/definitions/for_var" } ] }, @@ -396,7 +395,7 @@ }, "vars": { "description": "Values passed to the task called", - "$ref": "#/definitions/3/vars" + "$ref": "#/definitions/vars" } }, "oneOf": [ @@ -445,7 +444,7 @@ "type": "string" }, { - "$ref": "#/definitions/3/precondition_obj" + "$ref": "#/definitions/precondition_obj" } ] }, @@ -468,7 +467,7 @@ "type": "string" }, { - "$ref": "#/definitions/3/glob_obj" + "$ref": "#/definitions/glob_obj" } ] }, @@ -523,7 +522,6 @@ } } } - } }, "allOf": [ { @@ -545,8 +543,8 @@ "output": { "description": "Defines how the STDOUT and STDERR are printed when running tasks in parallel. The interleaved output prints lines in real time (default). The group output will print the entire output of a command once, after it finishes, so you won't have live feedback for commands that take a long time to run. The prefix output will prefix every line printed by a command with [task-name] as the prefix, but you can customize the prefix for a command with the prefix: attribute.", "anyOf": [ - { "$ref": "#/definitions/3/outputString" }, - { "$ref": "#/definitions/3/outputObject" } + { "$ref": "#/definitions/outputString" }, + { "$ref": "#/definitions/outputObject" } ] }, "method": { @@ -592,7 +590,7 @@ }, "vars": { "description": "A set of variables to apply to the included Taskfile.", - "$ref": "#/definitions/3/vars" + "$ref": "#/definitions/vars" } } } @@ -602,15 +600,15 @@ }, "vars": { "description": "A set of global variables.", - "$ref": "#/definitions/3/vars" + "$ref": "#/definitions/vars" }, "env": { "description": "A set of global environment variables.", - "$ref": "#/definitions/3/env" + "$ref": "#/definitions/env" }, "tasks": { "description": "A set of task definitions.", - "$ref": "#/definitions/3/tasks" + "$ref": "#/definitions/tasks" }, "silent": { "description": "Default 'silent' options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis.", @@ -620,14 +618,14 @@ "description": "Enables POSIX shell options for all commands in the Taskfile. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html", "type": "array", "items": { - "$ref": "#/definitions/3/set" + "$ref": "#/definitions/set" } }, "shopt": { "description": "Enables Bash shell options for all commands in the Taskfile. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html", "type": "array", "items": { - "$ref": "#/definitions/3/shopt" + "$ref": "#/definitions/shopt" } }, "dotenv": { @@ -639,7 +637,7 @@ }, "run": { "description": "Default 'run' option for this Taskfile. Available options: `always`, `once` and `when_changed`.", - "$ref": "#/definitions/3/run" + "$ref": "#/definitions/run" }, "interval": { "description": "Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid Go duration: https://pkg.go.dev/time#ParseDuration.",