diff --git a/src/validate_pyproject/plugins/setuptools.schema.json b/src/validate_pyproject/plugins/setuptools.schema.json index 226facd..f6441b5 100644 --- a/src/validate_pyproject/plugins/setuptools.schema.json +++ b/src/validate_pyproject/plugins/setuptools.schema.json @@ -226,9 +226,16 @@ } }, "readme": { + "type": "object", "anyOf": [ {"$ref": "#/definitions/file-directive"}, - {"properties": {"content-type": {"type": "string"}}} + { + "type": "object", + "properties": { + "content-type": {"type": "string"}, + "file": { "$ref": "#/definitions/file-directive/properties/file" } + }, + "additionalProperties": false} ], "required": ["file"] } diff --git a/tests/examples/setuptools/readme-pyproject.toml b/tests/examples/setuptools/readme-pyproject.toml new file mode 100644 index 0000000..3910149 --- /dev/null +++ b/tests/examples/setuptools/readme-pyproject.toml @@ -0,0 +1,2 @@ +[tool.setuptools] +dynamic.readme = { "file" = ["README.md"] } diff --git a/tests/invalid-examples/setuptools/dynamic/readme-missing-file.errors.txt b/tests/invalid-examples/setuptools/dynamic/readme-missing-file.errors.txt new file mode 100644 index 0000000..68f2670 --- /dev/null +++ b/tests/invalid-examples/setuptools/dynamic/readme-missing-file.errors.txt @@ -0,0 +1 @@ +`tool.setuptools.dynamic.readme` must contain ['file'] properties diff --git a/tests/invalid-examples/setuptools/dynamic/readme-missing-file.toml b/tests/invalid-examples/setuptools/dynamic/readme-missing-file.toml new file mode 100644 index 0000000..b2b5e1a --- /dev/null +++ b/tests/invalid-examples/setuptools/dynamic/readme-missing-file.toml @@ -0,0 +1,2 @@ +[tool.setuptools.dynamic.readme] +content-type = "text/plain" diff --git a/tests/invalid-examples/setuptools/dynamic/readme-too-many.errors.txt b/tests/invalid-examples/setuptools/dynamic/readme-too-many.errors.txt new file mode 100644 index 0000000..a9aaebc --- /dev/null +++ b/tests/invalid-examples/setuptools/dynamic/readme-too-many.errors.txt @@ -0,0 +1 @@ +`tool.setuptools.dynamic.readme` cannot be validated by any definition diff --git a/tests/invalid-examples/setuptools/dynamic/readme-too-many.toml b/tests/invalid-examples/setuptools/dynamic/readme-too-many.toml new file mode 100644 index 0000000..efa40ad --- /dev/null +++ b/tests/invalid-examples/setuptools/dynamic/readme-too-many.toml @@ -0,0 +1,4 @@ +[tool.setuptools.dynamic.readme] +file = ["README.md"] +content-type = "text/plain" +something-else = "not supposed to be here"