Skip to content

Commit

Permalink
Update generated client
Browse files Browse the repository at this point in the history
  • Loading branch information
mittwald-machine committed Mar 25, 2024
1 parent 39f06ea commit 03ce746
Show file tree
Hide file tree
Showing 16 changed files with 1,506 additions and 245 deletions.
32 changes: 2 additions & 30 deletions src/Generated/V2/Schemas/App/AppVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ class AppVersion
private static array $schema = [
'description' => 'An AppVersion is an officially supported version of an App, containing the necessary and recommended configuration und dependencies.',
'properties' => [
'appId' => [
'type' => 'string',
],
'breakingNote' => [
'$ref' => '#/components/schemas/de.mittwald.v1.app.BreakingNote',
],
Expand Down Expand Up @@ -81,13 +78,10 @@ class AppVersion
'internalVersion',
'docRoot',
'docRootUserEditable',
'appId',
],
'type' => 'object',
];

private string $appId;

private ?BreakingNote $breakingNote = null;

/**
Expand Down Expand Up @@ -119,21 +113,15 @@ class AppVersion
*/
private ?array $userInputs = null;

public function __construct(string $appId, string $docRoot, bool $docRootUserEditable, string $externalVersion, string $id, string $internalVersion)
public function __construct(string $docRoot, bool $docRootUserEditable, string $externalVersion, string $id, string $internalVersion)
{
$this->appId = $appId;
$this->docRoot = $docRoot;
$this->docRootUserEditable = $docRootUserEditable;
$this->externalVersion = $externalVersion;
$this->id = $id;
$this->internalVersion = $internalVersion;
}

public function getAppId(): string
{
return $this->appId;
}

public function getBreakingNote(): ?BreakingNote
{
return $this->breakingNote ?? null;
Expand Down Expand Up @@ -203,20 +191,6 @@ public function getUserInputs(): ?array
return $this->userInputs ?? null;
}

public function withAppId(string $appId): self
{
$validator = new Validator();
$validator->validate($appId, static::$schema['properties']['appId']);
if (!$validator->isValid()) {
throw new InvalidArgumentException($validator->getErrors()[0]['message']);
}

$clone = clone $this;
$clone->appId = $appId;

return $clone;
}

public function withBreakingNote(BreakingNote $breakingNote): self
{
$clone = clone $this;
Expand Down Expand Up @@ -413,7 +387,6 @@ public static function buildFromInput(array|object $input, bool $validate = true
static::validateInput($input);
}

$appId = $input->{'appId'};
$breakingNote = null;
if (isset($input->{'breakingNote'})) {
$breakingNote = BreakingNote::buildFromInput($input->{'breakingNote'}, validate: $validate);
Expand Down Expand Up @@ -444,7 +417,7 @@ public static function buildFromInput(array|object $input, bool $validate = true
$userInputs = array_map(fn (array|object $i): UserInput => UserInput::buildFromInput($i, validate: $validate), $input->{'userInputs'});
}

$obj = new self($appId, $docRoot, $docRootUserEditable, $externalVersion, $id, $internalVersion);
$obj = new self($docRoot, $docRootUserEditable, $externalVersion, $id, $internalVersion);
$obj->breakingNote = $breakingNote;
$obj->databases = $databases;
$obj->recommended = $recommended;
Expand All @@ -462,7 +435,6 @@ public static function buildFromInput(array|object $input, bool $validate = true
public function toJson(): array
{
$output = [];
$output['appId'] = $this->appId;
if (isset($this->breakingNote)) {
$output['breakingNote'] = $this->breakingNote->toJson();
}
Expand Down
1 change: 0 additions & 1 deletion src/Generated/V2/Schemas/App/UserInputFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ enum UserInputFormat: string
case email = 'email';
case password = 'password';
case url = 'url';
case uri = 'uri';
}
22 changes: 9 additions & 13 deletions src/Generated/V2/Schemas/Ingress/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class Path
[
'$ref' => '#/components/schemas/de.mittwald.v1.ingress.TargetUseDefaultPage',
],
[
'$ref' => '#/components/schemas/de.mittwald.v1.ingress.TargetContainer',
],
],
],
],
Expand All @@ -56,12 +53,12 @@ class Path

private string $path;

private TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage|TargetContainer $target;
private TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage $target;

/**
* @param TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage|TargetContainer $target
* @param TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage $target
*/
public function __construct(string $path, TargetContainer|TargetDirectory|TargetInstallation|TargetUrl|TargetUseDefaultPage $target)
public function __construct(string $path, TargetDirectory|TargetInstallation|TargetUrl|TargetUseDefaultPage $target)
{
$this->path = $path;
$this->target = $target;
Expand All @@ -74,9 +71,9 @@ public function getPath(): string

/**
* @return
* TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage|TargetContainer
* TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage
*/
public function getTarget(): TargetContainer|TargetDirectory|TargetInstallation|TargetUrl|TargetUseDefaultPage
public function getTarget(): TargetDirectory|TargetInstallation|TargetUrl|TargetUseDefaultPage
{
return $this->target;
}
Expand All @@ -96,9 +93,9 @@ public function withPath(string $path): self
}

/**
* @param TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage|TargetContainer $target
* @param TargetDirectory|TargetUrl|TargetInstallation|TargetUseDefaultPage $target
*/
public function withTarget(TargetContainer|TargetDirectory|TargetInstallation|TargetUrl|TargetUseDefaultPage $target): self
public function withTarget(TargetDirectory|TargetInstallation|TargetUrl|TargetUseDefaultPage $target): self
{
$clone = clone $this;
$clone->target = $target;
Expand Down Expand Up @@ -127,7 +124,6 @@ public static function buildFromInput(array|object $input, bool $validate = true
TargetUrl::validateInput($input->{'target'}, true) => TargetUrl::buildFromInput($input->{'target'}, validate: $validate),
TargetInstallation::validateInput($input->{'target'}, true) => TargetInstallation::buildFromInput($input->{'target'}, validate: $validate),
TargetUseDefaultPage::validateInput($input->{'target'}, true) => TargetUseDefaultPage::buildFromInput($input->{'target'}, validate: $validate),
TargetContainer::validateInput($input->{'target'}, true) => TargetContainer::buildFromInput($input->{'target'}, validate: $validate),
};

$obj = new self($path, $target);
Expand All @@ -145,7 +141,7 @@ public function toJson(): array
$output = [];
$output['path'] = $this->path;
$output['target'] = match (true) {
($this->target) instanceof TargetDirectory, ($this->target) instanceof TargetUrl, ($this->target) instanceof TargetInstallation, ($this->target) instanceof TargetUseDefaultPage, ($this->target) instanceof TargetContainer => $this->target->toJson(),
($this->target) instanceof TargetDirectory, ($this->target) instanceof TargetUrl, ($this->target) instanceof TargetInstallation, ($this->target) instanceof TargetUseDefaultPage => $this->target->toJson(),
};

return $output;
Expand Down Expand Up @@ -178,7 +174,7 @@ public static function validateInput(array|object $input, bool $return = false):
public function __clone()
{
$this->target = match (true) {
($this->target) instanceof TargetDirectory, ($this->target) instanceof TargetUrl, ($this->target) instanceof TargetInstallation, ($this->target) instanceof TargetUseDefaultPage, ($this->target) instanceof TargetContainer => $this->target,
($this->target) instanceof TargetDirectory, ($this->target) instanceof TargetUrl, ($this->target) instanceof TargetInstallation, ($this->target) instanceof TargetUseDefaultPage => $this->target,
};
}
}
134 changes: 0 additions & 134 deletions src/Generated/V2/Schemas/Ingress/TargetContainer.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Generated/V2/Schemas/Ingress/TargetUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class TargetUrl
private static array $schema = [
'properties' => [
'url' => [
'format' => 'uri',
'type' => 'string',
],
],
Expand Down
Loading

0 comments on commit 03ce746

Please sign in to comment.