Skip to content

Commit 0dbba04

Browse files
authored
🐛 Fix: DiffEntry's sha can be None (#197)
1 parent 333f218 commit 0dbba04

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

githubkit/versions/ghec_v2022_11_28/models/group_0264.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DiffEntry(GitHubModel):
2424
Diff Entry
2525
"""
2626

27-
sha: str = Field()
27+
sha: Union[str, None] = Field()
2828
filename: str = Field()
2929
status: Literal[
3030
"added", "removed", "modified", "renamed", "copied", "changed", "unchanged"

githubkit/versions/ghec_v2022_11_28/types/group_0264.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DiffEntryType(TypedDict):
1919
Diff Entry
2020
"""
2121

22-
sha: str
22+
sha: Union[str, None]
2323
filename: str
2424
status: Literal[
2525
"added", "removed", "modified", "renamed", "copied", "changed", "unchanged"

githubkit/versions/v2022_11_28/models/group_0224.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DiffEntry(GitHubModel):
2424
Diff Entry
2525
"""
2626

27-
sha: str = Field()
27+
sha: Union[str, None] = Field()
2828
filename: str = Field()
2929
status: Literal[
3030
"added", "removed", "modified", "renamed", "copied", "changed", "unchanged"

githubkit/versions/v2022_11_28/types/group_0224.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DiffEntryType(TypedDict):
1919
Diff Entry
2020
"""
2121

22-
sha: str
22+
sha: Union[str, None]
2323
filename: str
2424
status: Literal[
2525
"added", "removed", "modified", "renamed", "copied", "changed", "unchanged"

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ source = "https://raw.githubusercontent.com/github/rest-api-description/main/des
353353
"string",
354354
"null",
355355
] }
356+
# https://github.com/yanyongyu/githubkit/issues/196
357+
# https://github.com/github/rest-api-description/issues/4652
358+
# sha may be null when the file only changes permissions
359+
"/components/schemas/diff-entry/properties/sha" = { type = ["string", "null"] }
356360

357361
# [FIXED] copilot-seat-details/assignee is not valid
358362
# "/components/schemas/copilot-seat-details/properties/assignee" = { enum = "<unset>", oneOf = [

0 commit comments

Comments
 (0)