From f71a729731ae2f4b2466df1b5128a97a47846392 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Mon, 2 Mar 2026 03:59:52 +0000 Subject: [PATCH] :bug: fix code scanning alert schema error --- .../versions/ghec_v2022_11_28/models/group_0637.py | 4 ++-- .../versions/ghec_v2022_11_28/types/group_0637.py | 8 ++++---- githubkit/versions/v2022_11_28/models/group_0546.py | 4 ++-- githubkit/versions/v2022_11_28/types/group_0546.py | 8 ++++---- githubkit/versions/versions.lock | 2 ++ pyproject.toml | 12 ++++++++++++ 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/githubkit/versions/ghec_v2022_11_28/models/group_0637.py b/githubkit/versions/ghec_v2022_11_28/models/group_0637.py index 7d8a7253c..d3f460d01 100644 --- a/githubkit/versions/ghec_v2022_11_28/models/group_0637.py +++ b/githubkit/versions/ghec_v2022_11_28/models/group_0637.py @@ -46,7 +46,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel): dismissed_reason: Union[ None, Literal["false positive", "won't fix", "used in tests"] ] = Field(description="The reason for dismissing or closing the alert.") - fixed_at: Missing[None] = Field( + fixed_at: Missing[Union[_dt.datetime, None]] = Field( default=UNSET, description="The time that the alert was fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.", ) @@ -57,7 +57,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel): ] = Field(default=UNSET, title="Alert Instance") number: int = Field(description="The code scanning alert number.") rule: WebhookCodeScanningAlertFixedPropAlertPropRule = Field() - state: Union[None, Literal["fixed"]] = Field( + state: Union[None, Literal["fixed", "dismissed"]] = Field( 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." ) tool: WebhookCodeScanningAlertFixedPropAlertPropTool = Field() diff --git a/githubkit/versions/ghec_v2022_11_28/types/group_0637.py b/githubkit/versions/ghec_v2022_11_28/types/group_0637.py index 633b24dc1..e83f014e5 100644 --- a/githubkit/versions/ghec_v2022_11_28/types/group_0637.py +++ b/githubkit/versions/ghec_v2022_11_28/types/group_0637.py @@ -30,7 +30,7 @@ class WebhookCodeScanningAlertFixedPropAlertType(TypedDict): dismissed_reason: Union[ None, Literal["false positive", "won't fix", "used in tests"] ] - fixed_at: NotRequired[None] + fixed_at: NotRequired[Union[_dt.datetime, None]] html_url: str instances_url: NotRequired[str] most_recent_instance: NotRequired[ @@ -38,7 +38,7 @@ class WebhookCodeScanningAlertFixedPropAlertType(TypedDict): ] number: int rule: WebhookCodeScanningAlertFixedPropAlertPropRuleType - state: Union[None, Literal["fixed"]] + state: Union[None, Literal["fixed", "dismissed"]] tool: WebhookCodeScanningAlertFixedPropAlertPropToolType url: str @@ -59,7 +59,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict): dismissed_reason: Union[ None, Literal["false positive", "won't fix", "used in tests"] ] - fixed_at: NotRequired[None] + fixed_at: NotRequired[Union[str, None]] html_url: str instances_url: NotRequired[str] most_recent_instance: NotRequired[ @@ -70,7 +70,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict): ] number: int rule: WebhookCodeScanningAlertFixedPropAlertPropRuleTypeForResponse - state: Union[None, Literal["fixed"]] + state: Union[None, Literal["fixed", "dismissed"]] tool: WebhookCodeScanningAlertFixedPropAlertPropToolTypeForResponse url: str diff --git a/githubkit/versions/v2022_11_28/models/group_0546.py b/githubkit/versions/v2022_11_28/models/group_0546.py index 7d8a7253c..d3f460d01 100644 --- a/githubkit/versions/v2022_11_28/models/group_0546.py +++ b/githubkit/versions/v2022_11_28/models/group_0546.py @@ -46,7 +46,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel): dismissed_reason: Union[ None, Literal["false positive", "won't fix", "used in tests"] ] = Field(description="The reason for dismissing or closing the alert.") - fixed_at: Missing[None] = Field( + fixed_at: Missing[Union[_dt.datetime, None]] = Field( default=UNSET, description="The time that the alert was fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.", ) @@ -57,7 +57,7 @@ class WebhookCodeScanningAlertFixedPropAlert(GitHubModel): ] = Field(default=UNSET, title="Alert Instance") number: int = Field(description="The code scanning alert number.") rule: WebhookCodeScanningAlertFixedPropAlertPropRule = Field() - state: Union[None, Literal["fixed"]] = Field( + state: Union[None, Literal["fixed", "dismissed"]] = Field( 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." ) tool: WebhookCodeScanningAlertFixedPropAlertPropTool = Field() diff --git a/githubkit/versions/v2022_11_28/types/group_0546.py b/githubkit/versions/v2022_11_28/types/group_0546.py index 633b24dc1..e83f014e5 100644 --- a/githubkit/versions/v2022_11_28/types/group_0546.py +++ b/githubkit/versions/v2022_11_28/types/group_0546.py @@ -30,7 +30,7 @@ class WebhookCodeScanningAlertFixedPropAlertType(TypedDict): dismissed_reason: Union[ None, Literal["false positive", "won't fix", "used in tests"] ] - fixed_at: NotRequired[None] + fixed_at: NotRequired[Union[_dt.datetime, None]] html_url: str instances_url: NotRequired[str] most_recent_instance: NotRequired[ @@ -38,7 +38,7 @@ class WebhookCodeScanningAlertFixedPropAlertType(TypedDict): ] number: int rule: WebhookCodeScanningAlertFixedPropAlertPropRuleType - state: Union[None, Literal["fixed"]] + state: Union[None, Literal["fixed", "dismissed"]] tool: WebhookCodeScanningAlertFixedPropAlertPropToolType url: str @@ -59,7 +59,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict): dismissed_reason: Union[ None, Literal["false positive", "won't fix", "used in tests"] ] - fixed_at: NotRequired[None] + fixed_at: NotRequired[Union[str, None]] html_url: str instances_url: NotRequired[str] most_recent_instance: NotRequired[ @@ -70,7 +70,7 @@ class WebhookCodeScanningAlertFixedPropAlertTypeForResponse(TypedDict): ] number: int rule: WebhookCodeScanningAlertFixedPropAlertPropRuleTypeForResponse - state: Union[None, Literal["fixed"]] + state: Union[None, Literal["fixed", "dismissed"]] tool: WebhookCodeScanningAlertFixedPropAlertPropToolTypeForResponse url: str diff --git a/githubkit/versions/versions.lock b/githubkit/versions/versions.lock index 94bc4ae14..632f47521 100644 --- a/githubkit/versions/versions.lock +++ b/githubkit/versions/versions.lock @@ -142,6 +142,8 @@ source = "https://raw.githubusercontent.com/github/rest-api-description/513a9d0d "/components/schemas/webhook-workflow-run-in-progress/properties/workflow_run/properties/pull_requests/items/properties/number" = {type = "integer"} "/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/id" = {type = "integer"} "/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/number" = {type = "integer"} +"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/fixed_at" = {type = ["string", "null"], format = "date-time"} +"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/state/enum" = {"" = ["dismissed"]} "/webhooks/repository-dispatch-sample.collected/post" = {operationId = "repository-dispatch"} "/components/schemas/webhooks_answer/properties/parent_id" = {type = ["integer", "null"]} "/components/schemas/dependabot-alert-with-repository/properties/dependency/properties/relationship/enum" = {"" = ["inconclusive"]} diff --git a/pyproject.toml b/pyproject.toml index 5c988a567..1e5839b42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -550,6 +550,18 @@ source = "descriptions-next/ghec/ghec.2022-11-28.json" "/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/id" = { type = "integer" } "/components/schemas/webhook-workflow-run-requested/properties/workflow_run/properties/pull_requests/items/properties/number" = { type = "integer" } +# https://github.com/yanyongyu/githubkit/issues/275 +# https://github.com/github/rest-api-description/issues/6058 +"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/fixed_at" = { type = [ + "string", + "null", +], format = "date-time" } +# https://github.com/yanyongyu/githubkit/issues/276 +# https://github.com/github/rest-api-description/issues/6059 +"/components/schemas/webhook-code-scanning-alert-fixed/properties/alert/properties/state/enum" = { "" = [ + "dismissed", +] } + # webhook repository dispatch action can be any string "/webhooks/repository-dispatch-sample.collected/post" = { operationId = "repository-dispatch" } # "/components/schemas/webhook-repository-dispatch-sample/properties/action" = { enum = "" }