Skip to content

Commit 527cda1

Browse files
authored
🐛 Fix: WebhookCodeScanningAlertFixedPropAlert schema errors (#277)
1 parent 4dd5718 commit 527cda1

File tree

6 files changed

+26
-12
lines changed

6 files changed

+26
-12
lines changed

githubkit/versions/ghec_v2022_11_28/models/group_0637.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel):
4646
dismissed_reason: Union[
4747
None, Literal["false positive", "won't fix", "used in tests"]
4848
] = Field(description="The reason for dismissing or closing the alert.")
49-
fixed_at: Missing[None] = Field(
49+
fixed_at: Missing[Union[_dt.datetime, None]] = Field(
5050
default=UNSET,
5151
description="The time that the alert was fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
5252
)
@@ -57,7 +57,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel):
5757
] = Field(default=UNSET, title="Alert Instance")
5858
number: int = Field(description="The code scanning alert number.")
5959
rule: WebhookCodeScanningAlertFixedPropAlertPropRule = Field()
60-
state: Union[None, Literal["fixed"]] = Field(
60+
state: Union[None, Literal["fixed", "dismissed"]] = Field(
6161
description="State of a code scanning alert. Events for alerts found outside the default branch will return a `null` value until they are dismissed or fixed."
6262
)
6363
tool: WebhookCodeScanningAlertFixedPropAlertPropTool = Field()

githubkit/versions/ghec_v2022_11_28/types/group_0637.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ class WebhookCodeScanningAlertFixedPropAlertType(TypedDict):
3030
dismissed_reason: Union[
3131
None, Literal["false positive", "won't fix", "used in tests"]
3232
]
33-
fixed_at: NotRequired[None]
33+
fixed_at: NotRequired[Union[_dt.datetime, None]]
3434
html_url: str
3535
instances_url: NotRequired[str]
3636
most_recent_instance: NotRequired[
3737
Union[WebhookCodeScanningAlertFixedPropAlertPropMostRecentInstanceType, None]
3838
]
3939
number: int
4040
rule: WebhookCodeScanningAlertFixedPropAlertPropRuleType
41-
state: Union[None, Literal["fixed"]]
41+
state: Union[None, Literal["fixed", "dismissed"]]
4242
tool: WebhookCodeScanningAlertFixedPropAlertPropToolType
4343
url: str
4444

@@ -59,7 +59,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict):
5959
dismissed_reason: Union[
6060
None, Literal["false positive", "won't fix", "used in tests"]
6161
]
62-
fixed_at: NotRequired[None]
62+
fixed_at: NotRequired[Union[str, None]]
6363
html_url: str
6464
instances_url: NotRequired[str]
6565
most_recent_instance: NotRequired[
@@ -70,7 +70,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict):
7070
]
7171
number: int
7272
rule: WebhookCodeScanningAlertFixedPropAlertPropRuleTypeForResponse
73-
state: Union[None, Literal["fixed"]]
73+
state: Union[None, Literal["fixed", "dismissed"]]
7474
tool: WebhookCodeScanningAlertFixedPropAlertPropToolTypeForResponse
7575
url: str
7676

githubkit/versions/v2022_11_28/models/group_0546.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel):
4646
dismissed_reason: Union[
4747
None, Literal["false positive", "won't fix", "used in tests"]
4848
] = Field(description="The reason for dismissing or closing the alert.")
49-
fixed_at: Missing[None] = Field(
49+
fixed_at: Missing[Union[_dt.datetime, None]] = Field(
5050
default=UNSET,
5151
description="The time that the alert was fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
5252
)
@@ -57,7 +57,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel):
5757
] = Field(default=UNSET, title="Alert Instance")
5858
number: int = Field(description="The code scanning alert number.")
5959
rule: WebhookCodeScanningAlertFixedPropAlertPropRule = Field()
60-
state: Union[None, Literal["fixed"]] = Field(
60+
state: Union[None, Literal["fixed", "dismissed"]] = Field(
6161
description="State of a code scanning alert. Events for alerts found outside the default branch will return a `null` value until they are dismissed or fixed."
6262
)
6363
tool: WebhookCodeScanningAlertFixedPropAlertPropTool = Field()

githubkit/versions/v2022_11_28/types/group_0546.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ class WebhookCodeScanningAlertFixedPropAlertType(TypedDict):
3030
dismissed_reason: Union[
3131
None, Literal["false positive", "won't fix", "used in tests"]
3232
]
33-
fixed_at: NotRequired[None]
33+
fixed_at: NotRequired[Union[_dt.datetime, None]]
3434
html_url: str
3535
instances_url: NotRequired[str]
3636
most_recent_instance: NotRequired[
3737
Union[WebhookCodeScanningAlertFixedPropAlertPropMostRecentInstanceType, None]
3838
]
3939
number: int
4040
rule: WebhookCodeScanningAlertFixedPropAlertPropRuleType
41-
state: Union[None, Literal["fixed"]]
41+
state: Union[None, Literal["fixed", "dismissed"]]
4242
tool: WebhookCodeScanningAlertFixedPropAlertPropToolType
4343
url: str
4444

@@ -59,7 +59,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict):
5959
dismissed_reason: Union[
6060
None, Literal["false positive", "won't fix", "used in tests"]
6161
]
62-
fixed_at: NotRequired[None]
62+
fixed_at: NotRequired[Union[str, None]]
6363
html_url: str
6464
instances_url: NotRequired[str]
6565
most_recent_instance: NotRequired[
@@ -70,7 +70,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict):
7070
]
7171
number: int
7272
rule: WebhookCodeScanningAlertFixedPropAlertPropRuleTypeForResponse
73-
state: Union[None, Literal["fixed"]]
73+
state: Union[None, Literal["fixed", "dismissed"]]
7474
tool: WebhookCodeScanningAlertFixedPropAlertPropToolTypeForResponse
7575
url: str
7676

githubkit/versions/versions.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ source = "https://raw.githubusercontent.com/github/rest-api-description/513a9d0d
142142
"/components/schemas/webhook-workflow-run-in-progress/properties/workflow_run/properties/pull_requests/items/properties/number" = {type = "integer"}
143143
"/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/id" = {type = "integer"}
144144
"/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/number" = {type = "integer"}
145+
"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/fixed_at" = {type = ["string", "null"], format = "date-time"}
146+
"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/state/enum" = {"<add>" = ["dismissed"]}
145147
"/webhooks/repository-dispatch-sample.collected/post" = {operationId = "repository-dispatch"}
146148
"/components/schemas/webhooks_answer/properties/parent_id" = {type = ["integer", "null"]}
147149
"/components/schemas/dependabot-alert-with-repository/properties/dependency/properties/relationship/enum" = {"<add>" = ["inconclusive"]}

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,18 @@ source = "descriptions-next/ghec/ghec.2022-11-28.json"
550550
"/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/id" = { type = "integer" }
551551
"/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/number" = { type = "integer" }
552552

553+
# https://github.com/yanyongyu/githubkit/issues/275
554+
# https://github.com/github/rest-api-description/issues/6058
555+
"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/fixed_at" = { type = [
556+
"string",
557+
"null",
558+
], format = "date-time" }
559+
# https://github.com/yanyongyu/githubkit/issues/276
560+
# https://github.com/github/rest-api-description/issues/6059
561+
"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/state/enum" = { "<add>" = [
562+
"dismissed",
563+
] }
564+
553565
# webhook repository dispatch action can be any string
554566
"/webhooks/repository-dispatch-sample.collected/post" = { operationId = "repository-dispatch" }
555567
# "/components/schemas/webhook-repository-dispatch-sample/properties/action" = { enum = "<unset>" }

0 commit comments

Comments
 (0)