diff --git a/src/schemas/json/tox.json b/src/schemas/json/tox.json index dc59b9f71cc..cefe1e3cd6a 100644 --- a/src/schemas/json/tox.json +++ b/src/schemas/json/tox.json @@ -35,70 +35,7 @@ "env_list": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/definitions/subs" - }, - { - "type": "object", - "required": ["product"], - "properties": { - "product": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "object", - "required": ["prefix"], - "properties": { - "prefix": { - "type": "string" - }, - "start": { - "type": "integer" - }, - "stop": { - "type": "integer" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "minProperties": 1, - "maxProperties": 1, - "not": { - "required": ["prefix"] - }, - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": "labeled factor group for {factor:label} substitution" - } - ] - }, - "description": "factor groups for cartesian product expansion" - }, - "exclude": { - "type": "array", - "items": { - "type": "string" - }, - "description": "environment names to exclude from product" - } - }, - "additionalProperties": false - } - ] + "$ref": "#/definitions/env_list_item" }, "description": "define environments to automatically run" }, @@ -139,70 +76,7 @@ "additionalProperties": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/definitions/subs" - }, - { - "type": "object", - "required": ["product"], - "properties": { - "product": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "object", - "required": ["prefix"], - "properties": { - "prefix": { - "type": "string" - }, - "start": { - "type": "integer" - }, - "stop": { - "type": "integer" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "minProperties": 1, - "maxProperties": 1, - "not": { - "required": ["prefix"] - }, - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": "labeled factor group for {factor:label} substitution" - } - ] - }, - "description": "factor groups for cartesian product expansion" - }, - "exclude": { - "type": "array", - "items": { - "type": "string" - }, - "description": "environment names to exclude from product" - } - }, - "additionalProperties": false - } - ] + "$ref": "#/definitions/env_list_item" } }, "description": "core labels" @@ -286,70 +160,7 @@ "depends": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/definitions/subs" - }, - { - "type": "object", - "required": ["product"], - "properties": { - "product": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "object", - "required": ["prefix"], - "properties": { - "prefix": { - "type": "string" - }, - "start": { - "type": "integer" - }, - "stop": { - "type": "integer" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "minProperties": 1, - "maxProperties": 1, - "not": { - "required": ["prefix"] - }, - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": "labeled factor group for {factor:label} substitution" - } - ] - }, - "description": "factor groups for cartesian product expansion" - }, - "exclude": { - "type": "array", - "items": { - "type": "string" - }, - "description": "environment names to exclude from product" - } - }, - "additionalProperties": false - } - ] + "$ref": "#/definitions/env_list_item" }, "description": "tox environments that this environment depends on (must be run after those)" }, @@ -470,30 +281,51 @@ "commands_pre": { "type": "array", "items": { - "type": "array", - "items": { - "$ref": "#/definitions/subs" - } + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + }, + { + "$ref": "#/definitions/replace_object" + } + ] }, "description": "the commands to be called before testing" }, "commands": { "type": "array", "items": { - "type": "array", - "items": { - "$ref": "#/definitions/subs" - } + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + }, + { + "$ref": "#/definitions/replace_object" + } + ] }, "description": "the commands to be called for testing" }, "commands_post": { "type": "array", "items": { - "type": "array", - "items": { - "$ref": "#/definitions/subs" - } + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + }, + { + "$ref": "#/definitions/replace_object" + } + ] }, "description": "the commands to be called after testing" }, @@ -504,10 +336,17 @@ "recreate_commands": { "type": "array", "items": { - "type": "array", - "items": { - "$ref": "#/definitions/subs" - } + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + }, + { + "$ref": "#/definitions/replace_object" + } + ] }, "description": "commands to run before the environment is removed during recreation (e.g. cache cleanup)" }, @@ -623,10 +462,17 @@ "extra_setup_commands": { "type": "array", "items": { - "type": "array", - "items": { - "$ref": "#/definitions/subs" - } + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + }, + { + "$ref": "#/definitions/replace_object" + } + ] }, "description": "commands to execute after setup (deps and package install) but before test commands" }, @@ -727,65 +573,274 @@ "type": "string" }, { - "type": "object", - "properties": { - "replace": { + "$ref": "#/definitions/replace_env" + }, + { + "$ref": "#/definitions/replace_ref" + }, + { + "$ref": "#/definitions/replace_posargs" + }, + { + "$ref": "#/definitions/replace_glob" + }, + { + "$ref": "#/definitions/replace_if" + } + ] + }, + "replace_env": { + "type": "object", + "description": "substitute the value of an environment variable", + "properties": { + "replace": { + "const": "env" + }, + "name": { + "type": "string" + }, + "default": { + "oneOf": [ + { "type": "string" }, - "name": { + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + } + ] + }, + "extend": { + "type": "boolean" + }, + "marker": { + "type": "string" + } + }, + "required": ["replace", "name"], + "additionalProperties": false + }, + "replace_ref": { + "type": "object", + "description": "substitute the value of another configuration key", + "properties": { + "replace": { + "const": "ref" + }, + "of": { + "type": "array", + "items": { + "type": "string" + } + }, + "env": { + "type": "string" + }, + "key": { + "type": "string" + }, + "default": { + "oneOf": [ + { "type": "string" }, - "default": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/definitions/subs" - } - } - ] + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + } + ] + }, + "extend": { + "type": "boolean" + }, + "marker": { + "type": "string" + } + }, + "required": ["replace"], + "additionalProperties": false + }, + "replace_posargs": { + "type": "object", + "description": "substitute the positional arguments passed to tox", + "properties": { + "replace": { + "const": "posargs" + }, + "default": { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } + }, + "extend": { + "type": "boolean" + }, + "marker": { + "type": "string" + } + }, + "required": ["replace"], + "additionalProperties": false + }, + "replace_glob": { + "type": "object", + "description": "substitute matches of a filesystem glob pattern", + "properties": { + "replace": { + "const": "glob" + }, + "pattern": { + "type": "string" + }, + "default": { + "oneOf": [ + { + "type": "string" }, - "extend": { - "type": "boolean" + { + "type": "array", + "items": { + "$ref": "#/definitions/subs" + } } - }, - "required": ["replace"], - "additionalProperties": false + ] + }, + "extend": { + "type": "boolean" + }, + "marker": { + "type": "string" + } + }, + "required": ["replace", "pattern"], + "additionalProperties": false + }, + "replace_if": { + "type": "object", + "description": "conditional substitution based on env vars, factors, or env_name", + "properties": { + "replace": { + "const": "if" + }, + "condition": { + "type": "string" + }, + "then": true, + "else": true, + "extend": { + "type": "boolean" + }, + "marker": { + "type": "string" + } + }, + "required": ["replace", "condition", "then"], + "additionalProperties": false + }, + "replace_object": { + "description": "any of the table-form replacements; usable wherever a list item can be a replacement", + "anyOf": [ + { + "$ref": "#/definitions/replace_env" + }, + { + "$ref": "#/definitions/replace_ref" + }, + { + "$ref": "#/definitions/replace_posargs" + }, + { + "$ref": "#/definitions/replace_glob" + }, + { + "$ref": "#/definitions/replace_if" + } + ] + }, + "factor_range_dict": { + "type": "object", + "required": ["prefix"], + "properties": { + "prefix": { + "type": "string" + }, + "start": { + "type": "integer" + }, + "stop": { + "type": "integer" + } + }, + "additionalProperties": false, + "description": "range factor group: expands to prefix+N for N in [start, stop]" + }, + "factor_labeled_dict": { + "type": "object", + "minProperties": 1, + "maxProperties": 1, + "not": { + "required": ["prefix"] + }, + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": "labeled factor group for {factor:label} substitution" + }, + "product_factor_group": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "$ref": "#/definitions/factor_range_dict" + }, + { + "$ref": "#/definitions/factor_labeled_dict" + } + ] + }, + "env_list_item": { + "oneOf": [ + { + "$ref": "#/definitions/subs" }, { "type": "object", + "required": ["product"], "properties": { - "replace": { - "type": "string" + "product": { + "type": "array", + "items": { + "$ref": "#/definitions/product_factor_group" + }, + "description": "factor groups for cartesian product expansion" }, - "of": { + "exclude": { "type": "array", "items": { "type": "string" - } - }, - "default": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/definitions/subs" - } - } - ] - }, - "extend": { - "type": "boolean" + }, + "description": "environment names to exclude from product" } }, - "required": ["replace", "of"], "additionalProperties": false + }, + { + "$ref": "#/definitions/factor_range_dict" + }, + { + "$ref": "#/definitions/factor_labeled_dict" } ] }