Skip to content

Commit 151d08c

Browse files
authored
🐛 Fix: PR Head field type error (#202)
1 parent a1947d1 commit 151d08c

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

githubkit/versions/ghec_v2022_11_28/models/group_0383.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class PullRequestPropHead(GitHubModel):
2424

2525
label: Union[str, None] = Field()
2626
ref: str = Field()
27-
repo: Repository = Field(title="Repository", description="A repository on GitHub.")
27+
repo: Union[None, Repository] = Field()
2828
sha: str = Field()
29-
user: SimpleUser = Field(title="Simple User", description="A GitHub user.")
29+
user: Union[None, SimpleUser] = Field()
3030

3131

3232
class PullRequestPropBase(GitHubModel):

githubkit/versions/ghec_v2022_11_28/types/group_0383.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class PullRequestPropHeadType(TypedDict):
2121

2222
label: Union[str, None]
2323
ref: str
24-
repo: RepositoryType
24+
repo: Union[None, RepositoryType]
2525
sha: str
26-
user: SimpleUserType
26+
user: Union[None, SimpleUserType]
2727

2828

2929
class PullRequestPropBaseType(TypedDict):

githubkit/versions/v2022_11_28/models/group_0343.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class PullRequestPropHead(GitHubModel):
2424

2525
label: Union[str, None] = Field()
2626
ref: str = Field()
27-
repo: Repository = Field(title="Repository", description="A repository on GitHub.")
27+
repo: Union[None, Repository] = Field()
2828
sha: str = Field()
29-
user: SimpleUser = Field(title="Simple User", description="A GitHub user.")
29+
user: Union[None, SimpleUser] = Field()
3030

3131

3232
class PullRequestPropBase(GitHubModel):

githubkit/versions/v2022_11_28/types/group_0343.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class PullRequestPropHeadType(TypedDict):
2121

2222
label: Union[str, None]
2323
ref: str
24-
repo: RepositoryType
24+
repo: Union[None, RepositoryType]
2525
sha: str
26-
user: SimpleUserType
26+
user: Union[None, SimpleUserType]
2727

2828

2929
class PullRequestPropBaseType(TypedDict):

pyproject.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,15 @@ source = "https://raw.githubusercontent.com/github/rest-api-description/main/des
238238
"string",
239239
"null",
240240
] }
241-
"/components/schemas/pull-request/properties/head/properties/user" = { type = [
242-
"object",
243-
"null",
244-
] }
241+
"/components/schemas/pull-request/properties/head/properties/user" = { anyOf = [
242+
{ type = "null" },
243+
{ "$ref" = "#/components/schemas/simple-user" },
244+
], "$ref" = "<unset>" }
245+
# https://github.com/yanyongyu/githubkit/issues/200
246+
"/components/schemas/pull-request/properties/head/properties/repo" = { anyOf = [
247+
{ type = "null" },
248+
{ "$ref" = "#/components/schemas/repository" },
249+
], "$ref" = "<unset>" }
245250

246251
# https://github.com/github/rest-api-description/issues/1812
247252
"/components/schemas/pull-request-simple/properties/labels/items/properties/description" = { type = [

0 commit comments

Comments
 (0)