Skip to content

Commit ac67e96

Browse files
authored
🐛 fix url eval param name error
1 parent c678937 commit ac67e96

File tree

4,965 files changed

+255474
-244621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,965 files changed

+255474
-244621
lines changed

codegen/parser/data.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from collections import defaultdict
22
from dataclasses import dataclass, field
3+
from functools import cached_property
4+
import re
35
from typing import Literal
46

57
from .schemas import ModelSchema, Property, SchemaData, UnionSchema
@@ -139,6 +141,17 @@ def name(self) -> str:
139141
self.method, self.path.replace("{", "").replace("}", "").replace("/", "_")
140142
)
141143

144+
@cached_property
145+
def eval_path(self) -> str:
146+
"""Actual string used to construct the path with param names"""
147+
params_in_path = re.findall(r"\{([^\}]+)\}", self.path)
148+
param_name_map = {param.name: param.prop_name for param in self.path_params}
149+
path = self.path
150+
for param in params_in_path:
151+
if param in param_name_map:
152+
path = path.replace(f"{{{param}}}", f"{{{param_name_map[param]}}}")
153+
return path
154+
142155
@property
143156
def path_params(self) -> list[Parameter]:
144157
return [param for param in self.parameters if param.param_in == "path"]

codegen/templates/rest/_request.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{% macro build_path(endpoint) %}
66
{% if endpoint.path_params %}
7-
url = f"{{ endpoint.path }}"
7+
url = f"{{ endpoint.eval_path }}"
88
{% else %}
99
url = "{{ endpoint.path }}"
1010
{% endif %}

githubkit/rest/__init__.py

Lines changed: 117 additions & 53 deletions
Large diffs are not rendered by default.

githubkit/versions/ghec_v2022_11_28/models/__init__.py

Lines changed: 5089 additions & 4915 deletions
Large diffs are not rendered by default.

githubkit/versions/ghec_v2022_11_28/models/group_0029.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
from githubkit.compat import GitHubModel, model_rebuild
1515

1616

17-
class ActionsCacheUsageOrgEnterprise(GitHubModel):
18-
"""ActionsCacheUsageOrgEnterprise"""
17+
class EnterpriseAccessRestrictions(GitHubModel):
18+
"""Enterprise Access Restrictions
1919
20-
total_active_caches_count: int = Field(
21-
description="The count of active caches across all repositories of an enterprise or an organization."
22-
)
23-
total_active_caches_size_in_bytes: int = Field(
24-
description="The total size in bytes of all active cache items across all repositories of an enterprise or an organization."
25-
)
20+
Information about the enterprise access restrictions proxy header.
21+
"""
2622

23+
message: str = Field(description="The message returned for the request.")
24+
header_name: str = Field(description="The name of the proxy header.")
25+
header_value: str = Field(description="The value of the proxy header.")
2726

28-
model_rebuild(ActionsCacheUsageOrgEnterprise)
2927

30-
__all__ = ("ActionsCacheUsageOrgEnterprise",)
28+
model_rebuild(EnterpriseAccessRestrictions)
29+
30+
__all__ = ("EnterpriseAccessRestrictions",)

githubkit/versions/ghec_v2022_11_28/models/group_0030.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,17 @@
1414
from githubkit.compat import GitHubModel, model_rebuild
1515

1616

17-
class ActionsHostedRunnerMachineSpec(GitHubModel):
18-
"""Github-owned VM details.
17+
class ActionsCacheUsageOrgEnterprise(GitHubModel):
18+
"""ActionsCacheUsageOrgEnterprise"""
1919

20-
Provides details of a particular machine spec.
21-
"""
22-
23-
id: str = Field(
24-
description="The ID used for the `size` parameter when creating a new runner."
20+
total_active_caches_count: int = Field(
21+
description="The count of active caches across all repositories of an enterprise or an organization."
2522
)
26-
cpu_cores: int = Field(description="The number of cores.")
27-
memory_gb: int = Field(description="The available RAM for the machine spec.")
28-
storage_gb: int = Field(
29-
description="The available SSD storage for the machine spec."
23+
total_active_caches_size_in_bytes: int = Field(
24+
description="The total size in bytes of all active cache items across all repositories of an enterprise or an organization."
3025
)
3126

3227

33-
model_rebuild(ActionsHostedRunnerMachineSpec)
28+
model_rebuild(ActionsCacheUsageOrgEnterprise)
3429

35-
__all__ = ("ActionsHostedRunnerMachineSpec",)
30+
__all__ = ("ActionsCacheUsageOrgEnterprise",)

githubkit/versions/ghec_v2022_11_28/models/group_0031.py

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -9,95 +9,27 @@
99

1010
from __future__ import annotations
1111

12-
from datetime import datetime
13-
from typing import Literal, Union
14-
1512
from pydantic import Field
1613

1714
from githubkit.compat import GitHubModel, model_rebuild
18-
from githubkit.typing import Missing
19-
from githubkit.utils import UNSET
20-
21-
from .group_0030 import ActionsHostedRunnerMachineSpec
22-
23-
24-
class ActionsHostedRunner(GitHubModel):
25-
"""GitHub-hosted hosted runner
26-
27-
A Github-hosted hosted runner.
28-
"""
29-
30-
id: int = Field(description="The unique identifier of the hosted runner.")
31-
name: str = Field(description="The name of the hosted runner.")
32-
runner_group_id: Missing[int] = Field(
33-
default=UNSET,
34-
description="The unique identifier of the group that the hosted runner belongs to.",
35-
)
36-
image_details: Union[None, ActionsHostedRunnerPoolImage] = Field()
37-
machine_size_details: ActionsHostedRunnerMachineSpec = Field(
38-
title="Github-owned VM details.",
39-
description="Provides details of a particular machine spec.",
40-
)
41-
status: Literal["Ready", "Provisioning", "Shutdown", "Deleting", "Stuck"] = Field(
42-
description="The status of the runner."
43-
)
44-
platform: str = Field(description="The operating system of the image.")
45-
maximum_runners: Missing[int] = Field(
46-
default=UNSET,
47-
description="The maximum amount of hosted runners. Runners will not scale automatically above this number. Use this setting to limit your cost.",
48-
)
49-
public_ip_enabled: bool = Field(
50-
description="Whether public IP is enabled for the hosted runners."
51-
)
52-
public_ips: Missing[list[PublicIp]] = Field(
53-
default=UNSET,
54-
description="The public IP ranges when public IP is enabled for the hosted runners.",
55-
)
56-
last_active_on: Missing[Union[datetime, None]] = Field(
57-
default=UNSET,
58-
description="The time at which the runner was last used, in ISO 8601 format.",
59-
)
6015

6116

62-
class ActionsHostedRunnerPoolImage(GitHubModel):
63-
"""GitHub-hosted runner image details.
17+
class ActionsHostedRunnerMachineSpec(GitHubModel):
18+
"""Github-owned VM details.
6419
65-
Provides details of a hosted runner image
20+
Provides details of a particular machine spec.
6621
"""
6722

6823
id: str = Field(
69-
description="The ID of the image. Use this ID for the `image` parameter when creating a new larger runner."
70-
)
71-
size_gb: int = Field(description="Image size in GB.")
72-
display_name: str = Field(description="Display name for this image.")
73-
source: Literal["github", "partner", "custom"] = Field(
74-
description="The image provider."
75-
)
76-
77-
78-
class PublicIp(GitHubModel):
79-
"""Public IP for a GitHub-hosted larger runners.
80-
81-
Provides details of Public IP for a GitHub-hosted larger runners
82-
"""
83-
84-
enabled: Missing[bool] = Field(
85-
default=UNSET, description="Whether public IP is enabled."
86-
)
87-
prefix: Missing[str] = Field(
88-
default=UNSET, description="The prefix for the public IP."
24+
description="The ID used for the `size` parameter when creating a new runner."
8925
)
90-
length: Missing[int] = Field(
91-
default=UNSET, description="The length of the IP prefix."
26+
cpu_cores: int = Field(description="The number of cores.")
27+
memory_gb: int = Field(description="The available RAM for the machine spec.")
28+
storage_gb: int = Field(
29+
description="The available SSD storage for the machine spec."
9230
)
9331

9432

95-
model_rebuild(ActionsHostedRunner)
96-
model_rebuild(ActionsHostedRunnerPoolImage)
97-
model_rebuild(PublicIp)
33+
model_rebuild(ActionsHostedRunnerMachineSpec)
9834

99-
__all__ = (
100-
"ActionsHostedRunner",
101-
"ActionsHostedRunnerPoolImage",
102-
"PublicIp",
103-
)
35+
__all__ = ("ActionsHostedRunnerMachineSpec",)

githubkit/versions/ghec_v2022_11_28/models/group_0032.py

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,57 @@
99

1010
from __future__ import annotations
1111

12-
from typing import Literal
12+
from datetime import datetime
13+
from typing import Literal, Union
1314

1415
from pydantic import Field
1516

1617
from githubkit.compat import GitHubModel, model_rebuild
18+
from githubkit.typing import Missing
19+
from githubkit.utils import UNSET
1720

21+
from .group_0031 import ActionsHostedRunnerMachineSpec
1822

19-
class ActionsHostedRunnerCuratedImage(GitHubModel):
23+
24+
class ActionsHostedRunner(GitHubModel):
25+
"""GitHub-hosted hosted runner
26+
27+
A Github-hosted hosted runner.
28+
"""
29+
30+
id: int = Field(description="The unique identifier of the hosted runner.")
31+
name: str = Field(description="The name of the hosted runner.")
32+
runner_group_id: Missing[int] = Field(
33+
default=UNSET,
34+
description="The unique identifier of the group that the hosted runner belongs to.",
35+
)
36+
image_details: Union[None, ActionsHostedRunnerPoolImage] = Field()
37+
machine_size_details: ActionsHostedRunnerMachineSpec = Field(
38+
title="Github-owned VM details.",
39+
description="Provides details of a particular machine spec.",
40+
)
41+
status: Literal["Ready", "Provisioning", "Shutdown", "Deleting", "Stuck"] = Field(
42+
description="The status of the runner."
43+
)
44+
platform: str = Field(description="The operating system of the image.")
45+
maximum_runners: Missing[int] = Field(
46+
default=UNSET,
47+
description="The maximum amount of hosted runners. Runners will not scale automatically above this number. Use this setting to limit your cost.",
48+
)
49+
public_ip_enabled: bool = Field(
50+
description="Whether public IP is enabled for the hosted runners."
51+
)
52+
public_ips: Missing[list[PublicIp]] = Field(
53+
default=UNSET,
54+
description="The public IP ranges when public IP is enabled for the hosted runners.",
55+
)
56+
last_active_on: Missing[Union[datetime, None]] = Field(
57+
default=UNSET,
58+
description="The time at which the runner was last used, in ISO 8601 format.",
59+
)
60+
61+
62+
class ActionsHostedRunnerPoolImage(GitHubModel):
2063
"""GitHub-hosted runner image details.
2164
2265
Provides details of a hosted runner image
@@ -25,14 +68,36 @@ class ActionsHostedRunnerCuratedImage(GitHubModel):
2568
id: str = Field(
2669
description="The ID of the image. Use this ID for the `image` parameter when creating a new larger runner."
2770
)
28-
platform: str = Field(description="The operating system of the image.")
2971
size_gb: int = Field(description="Image size in GB.")
3072
display_name: str = Field(description="Display name for this image.")
3173
source: Literal["github", "partner", "custom"] = Field(
3274
description="The image provider."
3375
)
3476

3577

36-
model_rebuild(ActionsHostedRunnerCuratedImage)
78+
class PublicIp(GitHubModel):
79+
"""Public IP for a GitHub-hosted larger runners.
80+
81+
Provides details of Public IP for a GitHub-hosted larger runners
82+
"""
83+
84+
enabled: Missing[bool] = Field(
85+
default=UNSET, description="Whether public IP is enabled."
86+
)
87+
prefix: Missing[str] = Field(
88+
default=UNSET, description="The prefix for the public IP."
89+
)
90+
length: Missing[int] = Field(
91+
default=UNSET, description="The length of the IP prefix."
92+
)
93+
94+
95+
model_rebuild(ActionsHostedRunner)
96+
model_rebuild(ActionsHostedRunnerPoolImage)
97+
model_rebuild(PublicIp)
3798

38-
__all__ = ("ActionsHostedRunnerCuratedImage",)
99+
__all__ = (
100+
"ActionsHostedRunner",
101+
"ActionsHostedRunnerPoolImage",
102+
"PublicIp",
103+
)

githubkit/versions/ghec_v2022_11_28/models/group_0033.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,30 @@
99

1010
from __future__ import annotations
1111

12+
from typing import Literal
13+
1214
from pydantic import Field
1315

1416
from githubkit.compat import GitHubModel, model_rebuild
1517

1618

17-
class ActionsHostedRunnerLimits(GitHubModel):
18-
"""ActionsHostedRunnerLimits"""
19-
20-
public_ips: ActionsHostedRunnerLimitsPropPublicIps = Field(
21-
title="Static public IP Limits for GitHub-hosted Hosted Runners.",
22-
description="Provides details of static public IP limits for GitHub-hosted Hosted Runners",
23-
)
24-
25-
26-
class ActionsHostedRunnerLimitsPropPublicIps(GitHubModel):
27-
"""Static public IP Limits for GitHub-hosted Hosted Runners.
19+
class ActionsHostedRunnerCuratedImage(GitHubModel):
20+
"""GitHub-hosted runner image details.
2821
29-
Provides details of static public IP limits for GitHub-hosted Hosted Runners
22+
Provides details of a hosted runner image
3023
"""
3124

32-
maximum: int = Field(
33-
description="The maximum number of static public IP addresses that can be used for Hosted Runners."
25+
id: str = Field(
26+
description="The ID of the image. Use this ID for the `image` parameter when creating a new larger runner."
3427
)
35-
current_usage: int = Field(
36-
description="The current number of static public IP addresses in use by Hosted Runners."
28+
platform: str = Field(description="The operating system of the image.")
29+
size_gb: int = Field(description="Image size in GB.")
30+
display_name: str = Field(description="Display name for this image.")
31+
source: Literal["github", "partner", "custom"] = Field(
32+
description="The image provider."
3733
)
3834

3935

40-
model_rebuild(ActionsHostedRunnerLimits)
41-
model_rebuild(ActionsHostedRunnerLimitsPropPublicIps)
36+
model_rebuild(ActionsHostedRunnerCuratedImage)
4237

43-
__all__ = (
44-
"ActionsHostedRunnerLimits",
45-
"ActionsHostedRunnerLimitsPropPublicIps",
46-
)
38+
__all__ = ("ActionsHostedRunnerCuratedImage",)

githubkit/versions/ghec_v2022_11_28/models/group_0034.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,35 @@
1212
from pydantic import Field
1313

1414
from githubkit.compat import GitHubModel, model_rebuild
15-
from githubkit.typing import Missing
16-
from githubkit.utils import UNSET
1715

1816

19-
class ActionsOidcCustomIssuerPolicyForEnterprise(GitHubModel):
20-
"""ActionsOidcCustomIssuerPolicyForEnterprise"""
17+
class ActionsHostedRunnerLimits(GitHubModel):
18+
"""ActionsHostedRunnerLimits"""
2119

22-
include_enterprise_slug: Missing[bool] = Field(
23-
default=UNSET,
24-
description="Whether the enterprise customer requested a custom issuer URL.",
20+
public_ips: ActionsHostedRunnerLimitsPropPublicIps = Field(
21+
title="Static public IP Limits for GitHub-hosted Hosted Runners.",
22+
description="Provides details of static public IP limits for GitHub-hosted Hosted Runners",
2523
)
2624

2725

28-
model_rebuild(ActionsOidcCustomIssuerPolicyForEnterprise)
26+
class ActionsHostedRunnerLimitsPropPublicIps(GitHubModel):
27+
"""Static public IP Limits for GitHub-hosted Hosted Runners.
2928
30-
__all__ = ("ActionsOidcCustomIssuerPolicyForEnterprise",)
29+
Provides details of static public IP limits for GitHub-hosted Hosted Runners
30+
"""
31+
32+
maximum: int = Field(
33+
description="The maximum number of static public IP addresses that can be used for Hosted Runners."
34+
)
35+
current_usage: int = Field(
36+
description="The current number of static public IP addresses in use by Hosted Runners."
37+
)
38+
39+
40+
model_rebuild(ActionsHostedRunnerLimits)
41+
model_rebuild(ActionsHostedRunnerLimitsPropPublicIps)
42+
43+
__all__ = (
44+
"ActionsHostedRunnerLimits",
45+
"ActionsHostedRunnerLimitsPropPublicIps",
46+
)

0 commit comments

Comments
 (0)