Skip to content

Commit f219455

Browse files
authored
Merge pull request #1116 from php-api-clients/GitHub/from-1.1.4-a8553c6c66965737e86c74d1eeb4f1a6-from-1.1.4-a8553c6c66965737e86c74d1eeb4f1a6
2 parents dff3aa0 + b0f6c46 commit f219455

File tree

79 files changed

+1967
-173
lines changed

Some content is hidden

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

79 files changed

+1967
-173
lines changed

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

Lines changed: 84 additions & 76 deletions
Large diffs are not rendered by default.

clients/GitHub/src/Internal/Hydrator/Operation/Repos/Owner/Repo/Commits/CommitSha/BranchesWhereHead.php

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace ApiClients\Client\GitHub\Internal\Hydrator\Operation\Repos\Owner\Repo\Commits\CommitSha;
66

7+
use ApiClients\Client\GitHub\Schema\BasicError;
78
use ApiClients\Client\GitHub\Schema\ValidationError;
89
use EventSauce\ObjectHydrator\IterableList;
910
use EventSauce\ObjectHydrator\ObjectMapper;
@@ -39,6 +40,7 @@ public function hydrateObject(string $className, array $payload): object
3940
{
4041
return match ($className) {
4142
'ApiClients\Client\GitHub\Schema\ValidationError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError($payload),
43+
'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload),
4244
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
4345
};
4446
}
@@ -95,6 +97,69 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Vali
9597
}
9698
}
9799

100+
private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError
101+
{
102+
$properties = [];
103+
$missingFields = [];
104+
try {
105+
$value = $payload['message'] ?? null;
106+
107+
if ($value === null) {
108+
$properties['message'] = null;
109+
goto after_message;
110+
}
111+
112+
$properties['message'] = $value;
113+
114+
after_message:
115+
116+
$value = $payload['documentation_url'] ?? null;
117+
118+
if ($value === null) {
119+
$properties['documentationUrl'] = null;
120+
goto after_documentationUrl;
121+
}
122+
123+
$properties['documentationUrl'] = $value;
124+
125+
after_documentationUrl:
126+
127+
$value = $payload['url'] ?? null;
128+
129+
if ($value === null) {
130+
$properties['url'] = null;
131+
goto after_url;
132+
}
133+
134+
$properties['url'] = $value;
135+
136+
after_url:
137+
138+
$value = $payload['status'] ?? null;
139+
140+
if ($value === null) {
141+
$properties['status'] = null;
142+
goto after_status;
143+
}
144+
145+
$properties['status'] = $value;
146+
147+
after_status:
148+
} catch (Throwable $exception) {
149+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack);
150+
}
151+
152+
if (count($missingFields) > 0) {
153+
throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack);
154+
}
155+
156+
try {
157+
return new BasicError(...$properties);
158+
} catch (Throwable $exception) {
159+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack);
160+
}
161+
}
162+
98163
private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array
99164
{
100165
foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) {
@@ -127,6 +192,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
127192
'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object),
128193
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
129194
'ApiClients\Client\GitHub\Schema\ValidationError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError($object),
195+
'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object),
130196
default => throw new LogicException('No serialization defined for $className'),
131197
};
132198
} catch (Throwable $exception) {
@@ -218,6 +284,46 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
218284
return $result;
219285
}
220286

287+
private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed
288+
{
289+
assert($object instanceof BasicError);
290+
$result = [];
291+
292+
$message = $object->message;
293+
294+
if ($message === null) {
295+
goto after_message;
296+
}
297+
298+
after_message: $result['message'] = $message;
299+
300+
$documentationUrl = $object->documentationUrl;
301+
302+
if ($documentationUrl === null) {
303+
goto after_documentationUrl;
304+
}
305+
306+
after_documentationUrl: $result['documentation_url'] = $documentationUrl;
307+
308+
$url = $object->url;
309+
310+
if ($url === null) {
311+
goto after_url;
312+
}
313+
314+
after_url: $result['url'] = $url;
315+
316+
$status = $object->status;
317+
318+
if ($status === null) {
319+
goto after_status;
320+
}
321+
322+
after_status: $result['status'] = $status;
323+
324+
return $result;
325+
}
326+
221327
/**
222328
* @param class-string<T> $className
223329
* @param iterable<array> $payloads;

0 commit comments

Comments
 (0)