Skip to content

[GitHub] Update to 1.1.4-a937c40b238be216f274ad4de79f6216 from 1.1.4-5f0efa5b768ca4017b3104dc35554b9b #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clients/GitHub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ $client->call('GET /advisories', [
'published' => 'generated',
'updated' => 'generated',
'modified' => 'generated',
'epss_percentage' => 'generated',
'epss_percentile' => 'generated',
'before' => 'generated',
'after' => 'generated',
'type' => 'generated',
Expand All @@ -91,6 +93,8 @@ $client->operations()->securityAdvisories()->listGlobalAdvisories( ghsa_i
published: 'generated',
updated: 'generated',
modified: 'generated',
epss_percentage: 'generated',
epss_percentile: 'generated',
before: 'generated',
after: 'generated',
type: 'generated',
Expand Down
104 changes: 68 additions & 36 deletions clients/GitHub/etc/openapi-client-generator.state

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ApiClients\Client\GitHub\Schema\BasicError;
use ApiClients\Client\GitHub\Schema\GlobalAdvisory;
use ApiClients\Client\GitHub\Schema\GlobalAdvisory\Cvss;
use ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss;
use EventSauce\ObjectHydrator\IterableList;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertySerializers\SerializeArrayItems;
Expand Down Expand Up @@ -44,6 +45,7 @@ public function hydrateObject(string $className, array $payload): object
return match ($className) {
'ApiClients\Client\GitHub\Schema\GlobalAdvisory' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory($payload),
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Cvss' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Cvss($payload),
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($payload),
'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload),
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
};
Expand Down Expand Up @@ -283,6 +285,26 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Glob

after_cwes:

$value = $payload['epss'] ?? null;

if ($value === null) {
$properties['epss'] = null;
goto after_epss;
}

if (is_array($value)) {
try {
$this->hydrationStack[] = 'epss';
$value = $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($value);
} finally {
array_pop($this->hydrationStack);
}
}

$properties['epss'] = $value;

after_epss:

$value = $payload['credits'] ?? null;

if ($value === null) {
Expand Down Expand Up @@ -349,6 +371,47 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Glob
}
}

private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss(array $payload): Epss
{
$properties = [];
$missingFields = [];
try {
$value = $payload['percentage'] ?? null;

if ($value === null) {
$properties['percentage'] = null;
goto after_percentage;
}

$properties['percentage'] = $value;

after_percentage:

$value = $payload['percentile'] ?? null;

if ($value === null) {
$properties['percentile'] = null;
goto after_percentile;
}

$properties['percentile'] = $value;

after_percentile:
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss', $exception, stack: $this->hydrationStack);
}

if (count($missingFields) > 0) {
throw UnableToHydrateObject::dueToMissingFields(Epss::class, $missingFields, stack: $this->hydrationStack);
}

try {
return new Epss(...$properties);
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss', $exception, stack: $this->hydrationStack);
}
}

private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError
{
$properties = [];
Expand Down Expand Up @@ -445,6 +508,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
'ApiClients\Client\GitHub\Schema\GlobalAdvisory' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory($object),
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Cvss' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Cvss($object),
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($object),
'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object),
default => throw new LogicException("No serialization defined for $className"),
};
Expand Down Expand Up @@ -662,6 +726,15 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
$cwes = $cwesSerializer0->serialize($cwes, $this);
after_cwes: $result['cwes'] = $cwes;

$epss = $object->epss;

if ($epss === null) {
goto after_epss;
}

$epss = $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($epss);
after_epss: $result['epss'] = $epss;

$credits = $object->credits;

if ($credits === null) {
Expand Down Expand Up @@ -704,6 +777,30 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
return $result;
}

private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss(mixed $object): mixed
{
assert($object instanceof Epss);
$result = [];

$percentage = $object->percentage;

if ($percentage === null) {
goto after_percentage;
}

after_percentage: $result['percentage'] = $percentage;

$percentile = $object->percentile;

if ($percentile === null) {
goto after_percentile;
}

after_percentile: $result['percentile'] = $percentile;

return $result;
}

private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed
{
assert($object instanceof BasicError);
Expand Down
104 changes: 104 additions & 0 deletions clients/GitHub/src/Internal/Hydrator/Operation/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use ApiClients\Client\GitHub\Schema\ApiOverview;
use ApiClients\Client\GitHub\Schema\ApiOverview\Domains;
use ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations;
use ApiClients\Client\GitHub\Schema\ApiOverview\SshKeyFingerprints;
use EventSauce\ObjectHydrator\IterableList;
use EventSauce\ObjectHydrator\ObjectMapper;
Expand Down Expand Up @@ -45,6 +46,7 @@ public function hydrateObject(string $className, array $payload): object
'ApiClients\Client\GitHub\Schema\ApiOverview' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview($payload),
'ApiClients\Client\GitHub\Schema\ApiOverview\SshKeyFingerprints' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️SshKeyFingerprints($payload),
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains($payload),
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($payload),
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
};
}
Expand Down Expand Up @@ -384,6 +386,26 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiO
$properties['actions'] = $value;

after_actions:

$value = $payload['artifact_attestations'] ?? null;

if ($value === null) {
$properties['artifactAttestations'] = null;
goto after_artifactAttestations;
}

if (is_array($value)) {
try {
$this->hydrationStack[] = 'artifactAttestations';
$value = $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($value);
} finally {
array_pop($this->hydrationStack);
}
}

$properties['artifactAttestations'] = $value;

after_artifactAttestations:
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ApiOverview\Domains', $exception, stack: $this->hydrationStack);
}
Expand All @@ -399,6 +421,47 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiO
}
}

private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations(array $payload): ArtifactAttestations
{
$properties = [];
$missingFields = [];
try {
$value = $payload['trust_domain'] ?? null;

if ($value === null) {
$properties['trustDomain'] = null;
goto after_trustDomain;
}

$properties['trustDomain'] = $value;

after_trustDomain:

$value = $payload['services'] ?? null;

if ($value === null) {
$properties['services'] = null;
goto after_services;
}

$properties['services'] = $value;

after_services:
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations', $exception, stack: $this->hydrationStack);
}

if (count($missingFields) > 0) {
throw UnableToHydrateObject::dueToMissingFields(ArtifactAttestations::class, $missingFields, stack: $this->hydrationStack);
}

try {
return new ArtifactAttestations(...$properties);
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations', $exception, stack: $this->hydrationStack);
}
}

private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array
{
foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) {
Expand Down Expand Up @@ -433,6 +496,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
'ApiClients\Client\GitHub\Schema\ApiOverview' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview($object),
'ApiClients\Client\GitHub\Schema\ApiOverview\SshKeyFingerprints' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️SshKeyFingerprints($object),
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains($object),
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($object),
default => throw new LogicException("No serialization defined for $className"),
};
} catch (Throwable $exception) {
Expand Down Expand Up @@ -839,6 +903,46 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
$actions = $actionsSerializer0->serialize($actions, $this);
after_actions: $result['actions'] = $actions;

$artifactAttestations = $object->artifactAttestations;

if ($artifactAttestations === null) {
goto after_artifactAttestations;
}

$artifactAttestations = $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($artifactAttestations);
after_artifactAttestations: $result['artifact_attestations'] = $artifactAttestations;

return $result;
}

private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations(mixed $object): mixed
{
assert($object instanceof ArtifactAttestations);
$result = [];

$trustDomain = $object->trustDomain;

if ($trustDomain === null) {
goto after_trustDomain;
}

after_trustDomain: $result['trust_domain'] = $trustDomain;

$services = $object->services;

if ($services === null) {
goto after_services;
}

static $servicesSerializer0;

if ($servicesSerializer0 === null) {
$servicesSerializer0 = new SerializeArrayItems(...[]);
}

$services = $servicesSerializer0->serialize($services, $this);
after_services: $result['services'] = $services;

return $result;
}

Expand Down
Loading
Loading