Skip to content

Commit 7d988fa

Browse files
authored
Merge pull request #1226 from php-api-clients/GitHubEnterpriseCloud/from-1.1.4-79d271b80da67ba121ac31c018476e9a-from-1.1.4-79d271b80da67ba121ac31c018476e9a
2 parents 5c0435a + 45b43de commit 7d988fa

File tree

12 files changed

+425
-2191
lines changed

12 files changed

+425
-2191
lines changed

clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"specHash": "a64005d8253466da5566a833f48e8713",
2+
"specHash": "79d271b80da67ba121ac31c018476e9a",
33
"generatedFiles": {
44
"files": [
55
{
@@ -912,11 +912,11 @@
912912
},
913913
{
914914
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/Commit.php",
915-
"hash": "7ebe11d8f5ad4647053c9fd1d8027fc9"
915+
"hash": "d40a1afc41218da4b3f6749a14c5a25b"
916916
},
917917
{
918918
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/BranchWithProtection.php",
919-
"hash": "784c9d5b697d51fa5c1287cbcf99eff8"
919+
"hash": "a87380ca7ce948cdf11c5b474d63975f"
920920
},
921921
{
922922
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/StatusCheckPolicy.php",
@@ -1080,7 +1080,7 @@
10801080
},
10811081
{
10821082
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CommitComparison.php",
1083-
"hash": "044cbcc412aceb6a519f9122389f4673"
1083+
"hash": "8412e7ad502256268bdbb7a5c3a0d562"
10841084
},
10851085
{
10861086
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/ContentTree.php",
@@ -5948,7 +5948,7 @@
59485948
},
59495949
{
59505950
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Orgs.php",
5951-
"hash": "9a93d9aa406ccbbe614cafde1188f2ea"
5951+
"hash": "7bd1c3adf8e996d85469dca950b39651"
59525952
},
59535953
{
59545954
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Oidc.php",
@@ -27880,7 +27880,7 @@
2788027880
},
2788127881
{
2788227882
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Branches\/Branch.php",
27883-
"hash": "632a4c7b23199d7be935894847edda8d"
27883+
"hash": "36ac3a6dde2a6e1002550e8a28972589"
2788427884
},
2788527885
{
2788627886
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Branches\/Branch\/Protection.php",
@@ -27924,7 +27924,7 @@
2792427924
},
2792527925
{
2792627926
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Branches\/Branch\/Rename.php",
27927-
"hash": "71d6ee975cd6e9c4db5d90835e308479"
27927+
"hash": "e3c3ac4a5ef2af99567babe84fc36e09"
2792827928
},
2792927929
{
2793027930
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/CheckRuns.php",
@@ -28064,7 +28064,7 @@
2806428064
},
2806528065
{
2806628066
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Commits\/Ref.php",
28067-
"hash": "d91a40d2f5bf36d91a06f042f078916f"
28067+
"hash": "1ef733cfe9b949fc35c0a3a869d3168c"
2806828068
},
2806928069
{
2807028070
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Commits\/Ref\/CheckRuns.php",
@@ -28088,7 +28088,7 @@
2808828088
},
2808928089
{
2809028090
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Compare\/Basehead.php",
28091-
"hash": "214744b1eb3d3807355aaeb68af87805"
28091+
"hash": "56df5a809a0b8872be818dea632c97f0"
2809228092
},
2809328093
{
2809428094
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Contents\/Path.php",
@@ -28388,7 +28388,7 @@
2838828388
},
2838928389
{
2839028390
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Merges.php",
28391-
"hash": "44b444981a4eaf33589c0eb6b11dc581"
28391+
"hash": "4c12976504e013e197cfca13dd455b1e"
2839228392
},
2839328393
{
2839428394
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Milestones.php",
@@ -32581,6 +32581,14 @@
3258132581
{
3258232582
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/AliasAbstract\/TietA56E04B2\/Tiet87E35262\/Tiet960294EF\/Tiet9CED5A0E.php",
3258332583
"hash": "e5abfb688d26f732b23b64177d102320"
32584+
},
32585+
{
32586+
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/Commit\/Author.php",
32587+
"hash": "2836dfd692761f0f8caf0f43c5b65dda"
32588+
},
32589+
{
32590+
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/Commit\/Committer.php",
32591+
"hash": "19233f7704bb1a9834063a22618a0bd4"
3258432592
}
3258532593
]
3258632594
},
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHubEnterpriseCloud\Internal\Attribute\CastUnionToType\Schema\Commit;
6+
7+
use ApiClients\Client\GitHubEnterpriseCloud\Schema;
8+
use Attribute;
9+
use EventSauce\ObjectHydrator\ObjectMapper;
10+
use EventSauce\ObjectHydrator\PropertyCaster;
11+
use Throwable;
12+
13+
use function array_keys;
14+
use function array_unique;
15+
use function implode;
16+
use function is_array;
17+
use function sort;
18+
19+
#[Attribute(Attribute::TARGET_PARAMETER)]
20+
final class Author implements PropertyCaster
21+
{
22+
public function cast(mixed $value, ObjectMapper $hydrator): mixed
23+
{
24+
if (is_array($value)) {
25+
$signatureChunks = array_unique(array_keys($value));
26+
sort($signatureChunks);
27+
$signature = implode('|', $signatureChunks);
28+
if ($signature === 'avatar_url|email|events_url|followers_url|following_url|gists_url|gravatar_id|html_url|id|login|name|node_id|organizations_url|received_events_url|repos_url|site_admin|starred_at|starred_url|subscriptions_url|type|url') {
29+
try {
30+
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
31+
} catch (Throwable) {
32+
}
33+
}
34+
35+
if ($signature === '') {
36+
try {
37+
return $hydrator->hydrateObject(Schema\EmptyObject::class, $value);
38+
} catch (Throwable) {
39+
}
40+
}
41+
}
42+
43+
return $value;
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHubEnterpriseCloud\Internal\Attribute\CastUnionToType\Schema\Commit;
6+
7+
use ApiClients\Client\GitHubEnterpriseCloud\Schema;
8+
use Attribute;
9+
use EventSauce\ObjectHydrator\ObjectMapper;
10+
use EventSauce\ObjectHydrator\PropertyCaster;
11+
use Throwable;
12+
13+
use function array_keys;
14+
use function array_unique;
15+
use function implode;
16+
use function is_array;
17+
use function sort;
18+
19+
#[Attribute(Attribute::TARGET_PARAMETER)]
20+
final class Committer implements PropertyCaster
21+
{
22+
public function cast(mixed $value, ObjectMapper $hydrator): mixed
23+
{
24+
if (is_array($value)) {
25+
$signatureChunks = array_unique(array_keys($value));
26+
sort($signatureChunks);
27+
$signature = implode('|', $signatureChunks);
28+
if ($signature === 'avatar_url|email|events_url|followers_url|following_url|gists_url|gravatar_id|html_url|id|login|name|node_id|organizations_url|received_events_url|repos_url|site_admin|starred_at|starred_url|subscriptions_url|type|url') {
29+
try {
30+
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
31+
} catch (Throwable) {
32+
}
33+
}
34+
35+
if ($signature === '') {
36+
try {
37+
return $hydrator->hydrateObject(Schema\EmptyObject::class, $value);
38+
} catch (Throwable) {
39+
}
40+
}
41+
}
42+
43+
return $value;
44+
}
45+
}

0 commit comments

Comments
 (0)