Skip to content

Fix: repo owner can be null when account deleted #215

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

Merged
merged 1 commit into from
May 11, 2025
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
2 changes: 1 addition & 1 deletion githubkit/versions/ghec_v2022_11_28/models/group_0020.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Repository(GitHubModel):
license_: Union[None, LicenseSimple] = Field(alias="license")
forks: int = Field()
permissions: Missing[RepositoryPropPermissions] = Field(default=UNSET)
owner: SimpleUser = Field(title="Simple User", description="A GitHub user.")
owner: Union[None, SimpleUser] = Field()
private: bool = Field(
default=False, description="Whether the repository is private or public."
)
Expand Down
2 changes: 1 addition & 1 deletion githubkit/versions/ghec_v2022_11_28/types/group_0020.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RepositoryType(TypedDict):
license_: Union[None, LicenseSimpleType]
forks: int
permissions: NotRequired[RepositoryPropPermissionsType]
owner: SimpleUserType
owner: Union[None, SimpleUserType]
private: bool
html_url: str
description: Union[str, None]
Expand Down
2 changes: 1 addition & 1 deletion githubkit/versions/v2022_11_28/models/group_0020.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Repository(GitHubModel):
license_: Union[None, LicenseSimple] = Field(alias="license")
forks: int = Field()
permissions: Missing[RepositoryPropPermissions] = Field(default=UNSET)
owner: SimpleUser = Field(title="Simple User", description="A GitHub user.")
owner: Union[None, SimpleUser] = Field()
private: bool = Field(
default=False, description="Whether the repository is private or public."
)
Expand Down
2 changes: 1 addition & 1 deletion githubkit/versions/v2022_11_28/types/group_0020.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RepositoryType(TypedDict):
license_: Union[None, LicenseSimpleType]
forks: int
permissions: NotRequired[RepositoryPropPermissionsType]
owner: SimpleUserType
owner: Union[None, SimpleUserType]
private: bool
html_url: str
description: Union[str, None]
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ source = "https://raw.githubusercontent.com/github/rest-api-description/main/des
"null",
] }

# https://github.com/yanyongyu/githubkit/issues/214
# repo owner account may be deleted, can be null in pull request
"/components/schemas/repository/properties/owner" = { anyOf = [
{ type = "null" },
{ "$ref" = "#/components/schemas/simple-user" },
], "$ref" = "<unset>" }

# https://github.com/github/rest-api-description/issues/2491
"/components/schemas/auto-merge/properties/commit_title" = { type = [
"string",
Expand Down