diff --git a/src/schemas/json/maturin.json b/src/schemas/json/maturin.json index d89e754da3c..65a5d2e98f9 100644 --- a/src/schemas/json/maturin.json +++ b/src/schemas/json/maturin.json @@ -55,10 +55,10 @@ } }, "features": { - "description": "Space or comma separated list of features to activate", + "description": "List of features to activate.\nEach entry can be a plain feature name string, or a conditional object\nwith `feature` and `python-version` keys.", "type": ["array", "null"], "items": { - "type": "string" + "$ref": "#/definitions/FeatureSpec" } }, "frozen": { @@ -231,6 +231,30 @@ } } }, + "FeatureSpec": { + "description": "A cargo feature specification that can be either a plain feature name\nor a conditional feature that is only enabled for certain Python versions.\n\n# Examples\n\n```toml\n[tool.maturin]\nfeatures = [\n \"some-feature\",\n { feature = \"pyo3/abi3-py311\", python-version = \">=3.11\" },\n { feature = \"pyo3/abi3-py38\", python-version = \"<3.11\" },\n]\n```", + "anyOf": [ + { + "description": "A plain feature name, always enabled", + "type": "string" + }, + { + "description": "A feature enabled only when the target Python version matches", + "type": "object", + "properties": { + "feature": { + "description": "The cargo feature to enable", + "type": "string" + }, + "python-version": { + "description": "PEP 440 version specifier for the target Python version, e.g. \">=3.11\"", + "type": "string" + } + }, + "required": ["feature", "python-version"] + } + ] + }, "Format": { "description": "The target format for the include or exclude [GlobPattern].\n\nSee [Formats].", "oneOf": [