Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: setuptools readme field fix #116

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/validate_pyproject/plugins/setuptools.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
henryiii marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this could be moved inside the second anyOf item, however I liked the error message better this way, so unless it's required to make the Schema compliant to something, which it doesn't seem to be, I think putting it here is fine.

}
Expand Down
2 changes: 2 additions & 0 deletions tests/examples/setuptools/readme-pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.setuptools]
dynamic.readme = { "file" = ["README.md"] }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`tool.setuptools.dynamic.readme` must contain ['file'] properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.setuptools.dynamic.readme]
content-type = "text/plain"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`tool.setuptools.dynamic.readme` cannot be validated by any definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tool.setuptools.dynamic.readme]
file = ["README.md"]
content-type = "text/plain"
something-else = "not supposed to be here"