Skip to content

Commit 1035b7f

Browse files
authored
🐛 Fix: repo owner can be null when account deleted (#215)
1 parent f18426a commit 1035b7f

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

githubkit/versions/ghec_v2022_11_28/models/group_0020.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Repository(GitHubModel):
3535
license_: Union[None, LicenseSimple] = Field(alias="license")
3636
forks: int = Field()
3737
permissions: Missing[RepositoryPropPermissions] = Field(default=UNSET)
38-
owner: SimpleUser = Field(title="Simple User", description="A GitHub user.")
38+
owner: Union[None, SimpleUser] = Field()
3939
private: bool = Field(
4040
default=False, description="Whether the repository is private or public."
4141
)

githubkit/versions/ghec_v2022_11_28/types/group_0020.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RepositoryType(TypedDict):
3030
license_: Union[None, LicenseSimpleType]
3131
forks: int
3232
permissions: NotRequired[RepositoryPropPermissionsType]
33-
owner: SimpleUserType
33+
owner: Union[None, SimpleUserType]
3434
private: bool
3535
html_url: str
3636
description: Union[str, None]

githubkit/versions/v2022_11_28/models/group_0020.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Repository(GitHubModel):
3535
license_: Union[None, LicenseSimple] = Field(alias="license")
3636
forks: int = Field()
3737
permissions: Missing[RepositoryPropPermissions] = Field(default=UNSET)
38-
owner: SimpleUser = Field(title="Simple User", description="A GitHub user.")
38+
owner: Union[None, SimpleUser] = Field()
3939
private: bool = Field(
4040
default=False, description="Whether the repository is private or public."
4141
)

githubkit/versions/v2022_11_28/types/group_0020.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RepositoryType(TypedDict):
3030
license_: Union[None, LicenseSimpleType]
3131
forks: int
3232
permissions: NotRequired[RepositoryPropPermissionsType]
33-
owner: SimpleUserType
33+
owner: Union[None, SimpleUserType]
3434
private: bool
3535
html_url: str
3636
description: Union[str, None]

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,13 @@ source = "https://raw.githubusercontent.com/github/rest-api-description/main/des
293293
"null",
294294
] }
295295

296+
# https://github.com/yanyongyu/githubkit/issues/214
297+
# repo owner account may be deleted, can be null in pull request
298+
"/components/schemas/repository/properties/owner" = { anyOf = [
299+
{ type = "null" },
300+
{ "$ref" = "#/components/schemas/simple-user" },
301+
], "$ref" = "<unset>" }
302+
296303
# https://github.com/github/rest-api-description/issues/2491
297304
"/components/schemas/auto-merge/properties/commit_title" = { type = [
298305
"string",

0 commit comments

Comments
 (0)