From 7f9a5c2f63ac8b0f6ad559085d129c8177f40e97 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:17:30 +0800 Subject: [PATCH] :bug: Fix: not supported discriminators and repo check run status (#149) --- .../ghec_v2022_11_28/models/group_0051.py | 6 ++- .../ghec_v2022_11_28/models/group_0098.py | 4 ++ .../ghec_v2022_11_28/models/group_1010.py | 4 +- .../versions/ghec_v2022_11_28/rest/checks.py | 29 +++++------ .../versions/ghec_v2022_11_28/rest/repos.py | 49 ++++++------------- .../ghec_v2022_11_28/types/group_0051.py | 3 +- .../ghec_v2022_11_28/types/group_0098.py | 1 + .../ghec_v2022_11_28/types/group_1010.py | 4 +- .../versions/v2022_11_28/models/group_0030.py | 6 ++- .../versions/v2022_11_28/models/group_0082.py | 4 ++ .../versions/v2022_11_28/models/group_0936.py | 4 +- githubkit/versions/v2022_11_28/rest/checks.py | 29 +++++------ githubkit/versions/v2022_11_28/rest/repos.py | 49 ++++++------------- .../versions/v2022_11_28/types/group_0030.py | 3 +- .../versions/v2022_11_28/types/group_0082.py | 1 + .../versions/v2022_11_28/types/group_0936.py | 4 +- pyproject.toml | 12 +++++ 17 files changed, 104 insertions(+), 108 deletions(-) diff --git a/githubkit/versions/ghec_v2022_11_28/models/group_0051.py b/githubkit/versions/ghec_v2022_11_28/models/group_0051.py index ad8b037ae..8f21b89e0 100644 --- a/githubkit/versions/ghec_v2022_11_28/models/group_0051.py +++ b/githubkit/versions/ghec_v2022_11_28/models/group_0051.py @@ -9,7 +9,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Literal from datetime import date, datetime from pydantic import Field @@ -55,6 +55,10 @@ class CopilotSeatDetails(GitHubModel): default=UNSET, description="Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format.", ) + plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field( + default=UNSET, + description="The Copilot plan of the organization, or the parent enterprise, when applicable.", + ) class EnterpriseTeam(GitHubModel): diff --git a/githubkit/versions/ghec_v2022_11_28/models/group_0098.py b/githubkit/versions/ghec_v2022_11_28/models/group_0098.py index 81707263d..19a68e11a 100644 --- a/githubkit/versions/ghec_v2022_11_28/models/group_0098.py +++ b/githubkit/versions/ghec_v2022_11_28/models/group_0098.py @@ -49,6 +49,10 @@ class CopilotOrganizationDetails(ExtraGitHubModel): seat_management_setting: Literal[ "assign_all", "assign_selected", "disabled", "unconfigured" ] = Field(description="The mode of assigning new seats.") + plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field( + default=UNSET, + description="The Copilot plan of the organization, or the parent enterprise, when applicable.", + ) class CopilotSeatBreakdown(GitHubModel): diff --git a/githubkit/versions/ghec_v2022_11_28/models/group_1010.py b/githubkit/versions/ghec_v2022_11_28/models/group_1010.py index c855f38e2..84281942e 100644 --- a/githubkit/versions/ghec_v2022_11_28/models/group_1010.py +++ b/githubkit/versions/ghec_v2022_11_28/models/group_1010.py @@ -38,7 +38,9 @@ class ReposOwnerRepoCheckRunsPostBodyOneof1(ExtraGitHubModel): external_id: Missing[str] = Field( default=UNSET, description="A reference for the run on the integrator's system." ) - status: Missing[Literal["queued", "in_progress"]] = Field(default=UNSET) + status: Missing[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] = Field(default=UNSET) started_at: Missing[datetime] = Field( default=UNSET, description="The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.", diff --git a/githubkit/versions/ghec_v2022_11_28/rest/checks.py b/githubkit/versions/ghec_v2022_11_28/rest/checks.py index a522613c3..73992d778 100644 --- a/githubkit/versions/ghec_v2022_11_28/rest/checks.py +++ b/githubkit/versions/ghec_v2022_11_28/rest/checks.py @@ -10,10 +10,9 @@ from __future__ import annotations from weakref import ref -from typing_extensions import Annotated from typing import TYPE_CHECKING, Dict, Literal, Optional, overload -from pydantic import Field, BaseModel +from pydantic import BaseModel from githubkit.typing import Missing, UnsetType from githubkit.utils import UNSET, exclude_unset @@ -124,7 +123,9 @@ def create( head_sha: str, details_url: Missing[str] = UNSET, external_id: Missing[str] = UNSET, - status: Missing[Literal["queued", "in_progress"]] = UNSET, + status: Missing[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] = UNSET, started_at: Missing[datetime] = UNSET, conclusion: Missing[ Literal[ @@ -178,12 +179,9 @@ def create( json = kwargs if data is UNSET else data json = type_validate_python( - Annotated[ - Union[ - ReposOwnerRepoCheckRunsPostBodyOneof0, - ReposOwnerRepoCheckRunsPostBodyOneof1, - ], - Field(discriminator="status"), + Union[ + ReposOwnerRepoCheckRunsPostBodyOneof0, + ReposOwnerRepoCheckRunsPostBodyOneof1, ], json, ) @@ -253,7 +251,9 @@ async def async_create( head_sha: str, details_url: Missing[str] = UNSET, external_id: Missing[str] = UNSET, - status: Missing[Literal["queued", "in_progress"]] = UNSET, + status: Missing[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] = UNSET, started_at: Missing[datetime] = UNSET, conclusion: Missing[ Literal[ @@ -307,12 +307,9 @@ async def async_create( json = kwargs if data is UNSET else data json = type_validate_python( - Annotated[ - Union[ - ReposOwnerRepoCheckRunsPostBodyOneof0, - ReposOwnerRepoCheckRunsPostBodyOneof1, - ], - Field(discriminator="status"), + Union[ + ReposOwnerRepoCheckRunsPostBodyOneof0, + ReposOwnerRepoCheckRunsPostBodyOneof1, ], json, ) diff --git a/githubkit/versions/ghec_v2022_11_28/rest/repos.py b/githubkit/versions/ghec_v2022_11_28/rest/repos.py index af4a2a601..d8e8fe398 100644 --- a/githubkit/versions/ghec_v2022_11_28/rest/repos.py +++ b/githubkit/versions/ghec_v2022_11_28/rest/repos.py @@ -10,10 +10,9 @@ from __future__ import annotations from weakref import ref -from typing_extensions import Annotated from typing import TYPE_CHECKING, Dict, Literal, Optional, overload -from pydantic import Field, BaseModel +from pydantic import BaseModel from githubkit.typing import Missing, UnsetType from githubkit.utils import UNSET, exclude_unset @@ -7142,14 +7141,8 @@ def get_content( *, headers: Optional[Dict[str, str]] = None, ) -> Response[ - Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + Union[ + List[ContentDirectoryItems], ContentFile, ContentSymlink, ContentSubmodule ] ]: """See also: https://docs.github.com/enterprise-cloud@latest//rest/repos/contents#get-repository-content""" @@ -7177,14 +7170,11 @@ def get_content( url, params=exclude_unset(params), headers=exclude_unset(headers), - response_model=Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + response_model=Union[ + List[ContentDirectoryItems], + ContentFile, + ContentSymlink, + ContentSubmodule, ], error_models={ "404": BasicError, @@ -7201,14 +7191,8 @@ async def async_get_content( *, headers: Optional[Dict[str, str]] = None, ) -> Response[ - Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + Union[ + List[ContentDirectoryItems], ContentFile, ContentSymlink, ContentSubmodule ] ]: """See also: https://docs.github.com/enterprise-cloud@latest//rest/repos/contents#get-repository-content""" @@ -7236,14 +7220,11 @@ async def async_get_content( url, params=exclude_unset(params), headers=exclude_unset(headers), - response_model=Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + response_model=Union[ + List[ContentDirectoryItems], + ContentFile, + ContentSymlink, + ContentSubmodule, ], error_models={ "404": BasicError, diff --git a/githubkit/versions/ghec_v2022_11_28/types/group_0051.py b/githubkit/versions/ghec_v2022_11_28/types/group_0051.py index 5669fd7b3..e57d54897 100644 --- a/githubkit/versions/ghec_v2022_11_28/types/group_0051.py +++ b/githubkit/versions/ghec_v2022_11_28/types/group_0051.py @@ -9,7 +9,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Literal from datetime import date, datetime from typing_extensions import TypedDict, NotRequired @@ -33,6 +33,7 @@ class CopilotSeatDetailsType(TypedDict): last_activity_editor: NotRequired[Union[str, None]] created_at: datetime updated_at: NotRequired[datetime] + plan_type: NotRequired[Literal["business", "enterprise", "unknown"]] class EnterpriseTeamType(TypedDict): diff --git a/githubkit/versions/ghec_v2022_11_28/types/group_0098.py b/githubkit/versions/ghec_v2022_11_28/types/group_0098.py index 546434dbc..ac7ed0c1e 100644 --- a/githubkit/versions/ghec_v2022_11_28/types/group_0098.py +++ b/githubkit/versions/ghec_v2022_11_28/types/group_0098.py @@ -28,6 +28,7 @@ class CopilotOrganizationDetailsType(TypedDict): seat_management_setting: Literal[ "assign_all", "assign_selected", "disabled", "unconfigured" ] + plan_type: NotRequired[Literal["business", "enterprise", "unknown"]] class CopilotSeatBreakdownType(TypedDict): diff --git a/githubkit/versions/ghec_v2022_11_28/types/group_1010.py b/githubkit/versions/ghec_v2022_11_28/types/group_1010.py index f8dbc9ffc..c11a76c88 100644 --- a/githubkit/versions/ghec_v2022_11_28/types/group_1010.py +++ b/githubkit/versions/ghec_v2022_11_28/types/group_1010.py @@ -26,7 +26,9 @@ class ReposOwnerRepoCheckRunsPostBodyOneof1Type(TypedDict): head_sha: str details_url: NotRequired[str] external_id: NotRequired[str] - status: NotRequired[Literal["queued", "in_progress"]] + status: NotRequired[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] started_at: NotRequired[datetime] conclusion: NotRequired[ Literal[ diff --git a/githubkit/versions/v2022_11_28/models/group_0030.py b/githubkit/versions/v2022_11_28/models/group_0030.py index 5ed8ab3d2..7093e3e8b 100644 --- a/githubkit/versions/v2022_11_28/models/group_0030.py +++ b/githubkit/versions/v2022_11_28/models/group_0030.py @@ -9,7 +9,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Literal from datetime import date, datetime from pydantic import Field @@ -55,6 +55,10 @@ class CopilotSeatDetails(GitHubModel): default=UNSET, description="Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format.", ) + plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field( + default=UNSET, + description="The Copilot plan of the organization, or the parent enterprise, when applicable.", + ) class EnterpriseTeam(GitHubModel): diff --git a/githubkit/versions/v2022_11_28/models/group_0082.py b/githubkit/versions/v2022_11_28/models/group_0082.py index 81707263d..19a68e11a 100644 --- a/githubkit/versions/v2022_11_28/models/group_0082.py +++ b/githubkit/versions/v2022_11_28/models/group_0082.py @@ -49,6 +49,10 @@ class CopilotOrganizationDetails(ExtraGitHubModel): seat_management_setting: Literal[ "assign_all", "assign_selected", "disabled", "unconfigured" ] = Field(description="The mode of assigning new seats.") + plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field( + default=UNSET, + description="The Copilot plan of the organization, or the parent enterprise, when applicable.", + ) class CopilotSeatBreakdown(GitHubModel): diff --git a/githubkit/versions/v2022_11_28/models/group_0936.py b/githubkit/versions/v2022_11_28/models/group_0936.py index 7862e205c..b62a7c180 100644 --- a/githubkit/versions/v2022_11_28/models/group_0936.py +++ b/githubkit/versions/v2022_11_28/models/group_0936.py @@ -38,7 +38,9 @@ class ReposOwnerRepoCheckRunsPostBodyOneof1(ExtraGitHubModel): external_id: Missing[str] = Field( default=UNSET, description="A reference for the run on the integrator's system." ) - status: Missing[Literal["queued", "in_progress"]] = Field(default=UNSET) + status: Missing[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] = Field(default=UNSET) started_at: Missing[datetime] = Field( default=UNSET, description="The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.", diff --git a/githubkit/versions/v2022_11_28/rest/checks.py b/githubkit/versions/v2022_11_28/rest/checks.py index f1ad5ee56..0079d9194 100644 --- a/githubkit/versions/v2022_11_28/rest/checks.py +++ b/githubkit/versions/v2022_11_28/rest/checks.py @@ -10,10 +10,9 @@ from __future__ import annotations from weakref import ref -from typing_extensions import Annotated from typing import TYPE_CHECKING, Dict, Literal, Optional, overload -from pydantic import Field, BaseModel +from pydantic import BaseModel from githubkit.typing import Missing, UnsetType from githubkit.utils import UNSET, exclude_unset @@ -124,7 +123,9 @@ def create( head_sha: str, details_url: Missing[str] = UNSET, external_id: Missing[str] = UNSET, - status: Missing[Literal["queued", "in_progress"]] = UNSET, + status: Missing[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] = UNSET, started_at: Missing[datetime] = UNSET, conclusion: Missing[ Literal[ @@ -178,12 +179,9 @@ def create( json = kwargs if data is UNSET else data json = type_validate_python( - Annotated[ - Union[ - ReposOwnerRepoCheckRunsPostBodyOneof0, - ReposOwnerRepoCheckRunsPostBodyOneof1, - ], - Field(discriminator="status"), + Union[ + ReposOwnerRepoCheckRunsPostBodyOneof0, + ReposOwnerRepoCheckRunsPostBodyOneof1, ], json, ) @@ -253,7 +251,9 @@ async def async_create( head_sha: str, details_url: Missing[str] = UNSET, external_id: Missing[str] = UNSET, - status: Missing[Literal["queued", "in_progress"]] = UNSET, + status: Missing[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] = UNSET, started_at: Missing[datetime] = UNSET, conclusion: Missing[ Literal[ @@ -307,12 +307,9 @@ async def async_create( json = kwargs if data is UNSET else data json = type_validate_python( - Annotated[ - Union[ - ReposOwnerRepoCheckRunsPostBodyOneof0, - ReposOwnerRepoCheckRunsPostBodyOneof1, - ], - Field(discriminator="status"), + Union[ + ReposOwnerRepoCheckRunsPostBodyOneof0, + ReposOwnerRepoCheckRunsPostBodyOneof1, ], json, ) diff --git a/githubkit/versions/v2022_11_28/rest/repos.py b/githubkit/versions/v2022_11_28/rest/repos.py index a6cd48c33..5db01b280 100644 --- a/githubkit/versions/v2022_11_28/rest/repos.py +++ b/githubkit/versions/v2022_11_28/rest/repos.py @@ -10,10 +10,9 @@ from __future__ import annotations from weakref import ref -from typing_extensions import Annotated from typing import TYPE_CHECKING, Dict, Literal, Optional, overload -from pydantic import Field, BaseModel +from pydantic import BaseModel from githubkit.typing import Missing, UnsetType from githubkit.utils import UNSET, exclude_unset @@ -7142,14 +7141,8 @@ def get_content( *, headers: Optional[Dict[str, str]] = None, ) -> Response[ - Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + Union[ + List[ContentDirectoryItems], ContentFile, ContentSymlink, ContentSubmodule ] ]: """See also: https://docs.github.com/rest/repos/contents#get-repository-content""" @@ -7177,14 +7170,11 @@ def get_content( url, params=exclude_unset(params), headers=exclude_unset(headers), - response_model=Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + response_model=Union[ + List[ContentDirectoryItems], + ContentFile, + ContentSymlink, + ContentSubmodule, ], error_models={ "404": BasicError, @@ -7201,14 +7191,8 @@ async def async_get_content( *, headers: Optional[Dict[str, str]] = None, ) -> Response[ - Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + Union[ + List[ContentDirectoryItems], ContentFile, ContentSymlink, ContentSubmodule ] ]: """See also: https://docs.github.com/rest/repos/contents#get-repository-content""" @@ -7236,14 +7220,11 @@ async def async_get_content( url, params=exclude_unset(params), headers=exclude_unset(headers), - response_model=Annotated[ - Union[ - List[ContentDirectoryItems], - ContentFile, - ContentSymlink, - ContentSubmodule, - ], - Field(discriminator="type"), + response_model=Union[ + List[ContentDirectoryItems], + ContentFile, + ContentSymlink, + ContentSubmodule, ], error_models={ "404": BasicError, diff --git a/githubkit/versions/v2022_11_28/types/group_0030.py b/githubkit/versions/v2022_11_28/types/group_0030.py index bc3002e4d..c092bedf9 100644 --- a/githubkit/versions/v2022_11_28/types/group_0030.py +++ b/githubkit/versions/v2022_11_28/types/group_0030.py @@ -9,7 +9,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Literal from datetime import date, datetime from typing_extensions import TypedDict, NotRequired @@ -33,6 +33,7 @@ class CopilotSeatDetailsType(TypedDict): last_activity_editor: NotRequired[Union[str, None]] created_at: datetime updated_at: NotRequired[datetime] + plan_type: NotRequired[Literal["business", "enterprise", "unknown"]] class EnterpriseTeamType(TypedDict): diff --git a/githubkit/versions/v2022_11_28/types/group_0082.py b/githubkit/versions/v2022_11_28/types/group_0082.py index 546434dbc..ac7ed0c1e 100644 --- a/githubkit/versions/v2022_11_28/types/group_0082.py +++ b/githubkit/versions/v2022_11_28/types/group_0082.py @@ -28,6 +28,7 @@ class CopilotOrganizationDetailsType(TypedDict): seat_management_setting: Literal[ "assign_all", "assign_selected", "disabled", "unconfigured" ] + plan_type: NotRequired[Literal["business", "enterprise", "unknown"]] class CopilotSeatBreakdownType(TypedDict): diff --git a/githubkit/versions/v2022_11_28/types/group_0936.py b/githubkit/versions/v2022_11_28/types/group_0936.py index 2b594af5f..b1d258acf 100644 --- a/githubkit/versions/v2022_11_28/types/group_0936.py +++ b/githubkit/versions/v2022_11_28/types/group_0936.py @@ -26,7 +26,9 @@ class ReposOwnerRepoCheckRunsPostBodyOneof1Type(TypedDict): head_sha: str details_url: NotRequired[str] external_id: NotRequired[str] - status: NotRequired[Literal["queued", "in_progress"]] + status: NotRequired[ + Literal["queued", "in_progress", "waiting", "requested", "pending"] + ] started_at: NotRequired[datetime] conclusion: NotRequired[ Literal[ diff --git a/pyproject.toml b/pyproject.toml index 9d3a8f71b..62c01d322 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -374,6 +374,18 @@ source = "https://raw.githubusercontent.com/github/rest-api-description/main/des "submitted", ] } +# https://github.com/yanyongyu/githubkit/issues/148 +"/paths/~1repos~1{owner}~1{repo}~1check-runs/post/requestBody/content/application~1json/schema" = { discriminator = "" } +# repo check runs status enum may have more values (missing in oneOf) +"/paths/~1repos~1{owner}~1{repo}~1check-runs/post/requestBody/content/application~1json/schema/oneOf/1/properties/status/enum" = { "" = [ + "waiting", + "requested", + "pending", +] } + +# get repo content response discriminator not supported +"/paths/~1repos~1{owner}~1{repo}~1contents~1{path}/get/responses/200/content/application~1json/schema" = { discriminator = "" } + # Webhook schema overrides # webhook check run action is required "/components/schemas/webhook-check-run-completed/required" = { "" = [