mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 17:12:49 +00:00
[PHP] New client generator php-dt (#10041)
* - new PHP client generator php-dt * - samples regen after rebase * - README update * - fix missing options for php-dt-modern config * - use another workaround to prevent special treatment of form media types in DefaultGenerator - GlobalSettings usage mangled behaviour of other generators - fix of missing spaces in generated docs * - samples update after rebase
This commit is contained in:
1471
samples/client/petstore/php-dt-modern/src/App/ApiClient.php
Normal file
1471
samples/client/petstore/php-dt-modern/src/App/ApiClient.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use Articus\DataTransfer as DT;
|
||||
use Interop\Container\ContainerInterface;
|
||||
use OpenAPIGenerator\APIClient as OAGAC;
|
||||
|
||||
class ApiClientFactory extends DT\ConfigAwareFactory
|
||||
{
|
||||
public function __construct(string $configKey = ApiClient::class)
|
||||
{
|
||||
parent::__construct($configKey);
|
||||
}
|
||||
|
||||
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
|
||||
{
|
||||
$config = new OAGAC\ApiClientOptions(\array_merge($this->getServiceConfig($container), $options ?? []));
|
||||
return new ApiClient(
|
||||
$config->serverUrl,
|
||||
$container->get($config->dataTransferServiceName),
|
||||
$container->get($config->requestFactoryServiceName),
|
||||
$container->get($config->httpClientServiceName),
|
||||
$container->get($config->securityProviderFactoryServiceName),
|
||||
$container->get($config->bodyCoderFactoryServiceName),
|
||||
$container->get($config->bodyCoderFactoryServiceName)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
*/
|
||||
class ApiResponse
|
||||
{
|
||||
#[DTA\Data(field: "code", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $code = null;
|
||||
|
||||
#[DTA\Data(field: "type", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $type = null;
|
||||
|
||||
#[DTA\Data(field: "message", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $message = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
*/
|
||||
class Category
|
||||
{
|
||||
#[DTA\Data(field: "id", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $id = null;
|
||||
|
||||
#[DTA\Data(field: "name", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
#[DTA\Validator("Regex", ["pattern" => "/^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$/"])]
|
||||
public string|null $name = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection1 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection10 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection11 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection12 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection13 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection14 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection15 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection16 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection17 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection18 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Pet::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Pet::class]]
|
||||
]])]
|
||||
class Collection19 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection2 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection20 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection21 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Pet::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Pet::class]]
|
||||
]])]
|
||||
class Collection22 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection23 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection24 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection25 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Pet::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Pet::class]]
|
||||
]])]
|
||||
class Collection26 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection27 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection28 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Pet::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Pet::class]]
|
||||
]])]
|
||||
class Collection29 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection3 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection30 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection31 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection32 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection33 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarMap", ["type" => "int"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "int"]]
|
||||
]])]
|
||||
class Collection34 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\User::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\User::class]]
|
||||
]])]
|
||||
class Collection35 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\User::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\User::class]]
|
||||
]])]
|
||||
class Collection36 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection4 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection5 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection6 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection7 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ScalarList", ["type" => "string"])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "Scalar", "options" => ["type" => "string"]]
|
||||
]])]
|
||||
class Collection8 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
#[DTA\Strategy("ObjectList", ["type" => \App\DTO\Tag::class])]
|
||||
#[DTA\Validator("Collection", ["validators" => [
|
||||
["name" => "TypeCompliant", "options" => ["type" => \App\DTO\Tag::class]]
|
||||
]])]
|
||||
class Collection9 extends \ArrayObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for deleteOrder
|
||||
*/
|
||||
class DeleteOrderParameterData
|
||||
{
|
||||
/**
|
||||
* ID of the order that needs to be deleted
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "orderId")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "string"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "string"], subset: "path")]
|
||||
public string|null $order_id = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for deletePet
|
||||
*/
|
||||
class DeletePetParameterData
|
||||
{
|
||||
/**
|
||||
* Pet id to delete
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "petId")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "int"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "int"], subset: "path")]
|
||||
public int|null $pet_id = null;
|
||||
|
||||
#[DTA\Data(subset: "header", field: "api_key", nullable: true)]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "string"], "header")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "string"], subset: "header")]
|
||||
public string|null $api_key = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for deleteUser
|
||||
*/
|
||||
class DeleteUserParameterData
|
||||
{
|
||||
/**
|
||||
* The name that needs to be deleted
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "username")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "string"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "string"], subset: "path")]
|
||||
public string|null $username = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for findPetsByStatus
|
||||
*/
|
||||
class FindPetsByStatusParameterData
|
||||
{
|
||||
/**
|
||||
* Status values that need to be considered for filter
|
||||
*/
|
||||
#[DTA\Data(subset: "query", field: "status")]
|
||||
#[DTA\Strategy("QueryStringScalarArray", ["type" => "string", "format" => "csv"], "query")]
|
||||
#[DTA\Validator("QueryStringScalarArray", ["type" => "string", "format" => "csv"], subset: "query")]
|
||||
public array|null $status = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for findPetsByTags
|
||||
*/
|
||||
class FindPetsByTagsParameterData
|
||||
{
|
||||
/**
|
||||
* Tags to filter by
|
||||
*/
|
||||
#[DTA\Data(subset: "query", field: "tags")]
|
||||
#[DTA\Strategy("QueryStringScalarArray", ["type" => "string", "format" => "csv"], "query")]
|
||||
#[DTA\Validator("QueryStringScalarArray", ["type" => "string", "format" => "csv"], subset: "query")]
|
||||
public array|null $tags = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for getOrderById
|
||||
*/
|
||||
class GetOrderByIdParameterData
|
||||
{
|
||||
/**
|
||||
* ID of pet that needs to be fetched
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "orderId")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "int"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "int"], subset: "path")]
|
||||
#[DTA\Validator("GreaterThan", ["min" => 1, "inclusive" => true], subset: "path")]
|
||||
#[DTA\Validator("LessThan", ["max" => 5, "inclusive" => true], subset: "path")]
|
||||
public int|null $order_id = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for getPetById
|
||||
*/
|
||||
class GetPetByIdParameterData
|
||||
{
|
||||
/**
|
||||
* ID of pet to return
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "petId")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "int"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "int"], subset: "path")]
|
||||
public int|null $pet_id = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for getUserByName
|
||||
*/
|
||||
class GetUserByNameParameterData
|
||||
{
|
||||
/**
|
||||
* The name that needs to be fetched. Use user1 for testing.
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "username")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "string"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "string"], subset: "path")]
|
||||
public string|null $username = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
class InlineObject
|
||||
{
|
||||
/**
|
||||
* Updated name of the pet
|
||||
*/
|
||||
#[DTA\Data(field: "name", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $name = null;
|
||||
|
||||
/**
|
||||
* Updated status of the pet
|
||||
*/
|
||||
#[DTA\Data(field: "status", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $status = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
class InlineObject1
|
||||
{
|
||||
/**
|
||||
* Additional data to pass to server
|
||||
*/
|
||||
#[DTA\Data(field: "additionalMetadata", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $additional_metadata = null;
|
||||
|
||||
/**
|
||||
* file to upload
|
||||
*/
|
||||
#[DTA\Data(field: "file", nullable: true)]
|
||||
#[DTA\Strategy("Object", ["type" => \SplFileObject::class])]
|
||||
#[DTA\Validator("TypeCompliant", ["type" => \SplFileObject::class])]
|
||||
public \SplFileObject|null $file = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for loginUser
|
||||
*/
|
||||
class LoginUserParameterData
|
||||
{
|
||||
/**
|
||||
* The password for login in clear text
|
||||
*/
|
||||
#[DTA\Data(subset: "query", field: "password")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "string"], "query")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "string"], subset: "query")]
|
||||
public string|null $password = null;
|
||||
|
||||
/**
|
||||
* The user name for login
|
||||
*/
|
||||
#[DTA\Data(subset: "query", field: "username")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "string"], "query")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "string"], subset: "query")]
|
||||
#[DTA\Validator("Regex", ["pattern" => "/^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$/"], subset: "query")]
|
||||
public string|null $username = null;
|
||||
|
||||
}
|
||||
41
samples/client/petstore/php-dt-modern/src/App/DTO/Order.php
Normal file
41
samples/client/petstore/php-dt-modern/src/App/DTO/Order.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
*/
|
||||
class Order
|
||||
{
|
||||
#[DTA\Data(field: "id", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $id = null;
|
||||
|
||||
#[DTA\Data(field: "petId", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $pet_id = null;
|
||||
|
||||
#[DTA\Data(field: "quantity", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $quantity = null;
|
||||
|
||||
#[DTA\Data(field: "shipDate", nullable: true)]
|
||||
#[DTA\Strategy("DateTime")]
|
||||
#[DTA\Validator("Date", ["format" => \DateTime::RFC3339])]
|
||||
public \DateTime|null $ship_date = null;
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
#[DTA\Data(field: "status", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $status = null;
|
||||
|
||||
#[DTA\Data(field: "complete", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "bool"])]
|
||||
public bool|null $complete = null;
|
||||
|
||||
}
|
||||
43
samples/client/petstore/php-dt-modern/src/App/DTO/Pet.php
Normal file
43
samples/client/petstore/php-dt-modern/src/App/DTO/Pet.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
*/
|
||||
class Pet
|
||||
{
|
||||
#[DTA\Data(field: "id", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $id = null;
|
||||
|
||||
#[DTA\Data(field: "category", nullable: true)]
|
||||
#[DTA\Strategy("Object", ["type" => \App\DTO\Category::class])]
|
||||
#[DTA\Validator("TypeCompliant", ["type" => \App\DTO\Category::class])]
|
||||
public \App\DTO\Category|null $category = null;
|
||||
|
||||
#[DTA\Data(field: "name")]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $name = null;
|
||||
|
||||
#[DTA\Data(field: "photoUrls")]
|
||||
#[DTA\Strategy("Object", ["type" => \App\DTO\Collection32::class])]
|
||||
#[DTA\Validator("TypeCompliant", ["type" => \App\DTO\Collection32::class])]
|
||||
public \App\DTO\Collection32|null $photo_urls = null;
|
||||
|
||||
#[DTA\Data(field: "tags", nullable: true)]
|
||||
#[DTA\Strategy("Object", ["type" => \App\DTO\Collection33::class])]
|
||||
#[DTA\Validator("TypeCompliant", ["type" => \App\DTO\Collection33::class])]
|
||||
public \App\DTO\Collection33|null $tags = null;
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
#[DTA\Data(field: "status", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $status = null;
|
||||
|
||||
}
|
||||
21
samples/client/petstore/php-dt-modern/src/App/DTO/Tag.php
Normal file
21
samples/client/petstore/php-dt-modern/src/App/DTO/Tag.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
*/
|
||||
class Tag
|
||||
{
|
||||
#[DTA\Data(field: "id", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $id = null;
|
||||
|
||||
#[DTA\Data(field: "name", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $name = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for updatePetWithForm
|
||||
*/
|
||||
class UpdatePetWithFormParameterData
|
||||
{
|
||||
/**
|
||||
* ID of pet that needs to be updated
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "petId")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "int"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "int"], subset: "path")]
|
||||
public int|null $pet_id = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for updateUser
|
||||
*/
|
||||
class UpdateUserParameterData
|
||||
{
|
||||
/**
|
||||
* name that need to be deleted
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "username")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "string"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "string"], subset: "path")]
|
||||
public string|null $username = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* Parameters for uploadFile
|
||||
*/
|
||||
class UploadFileParameterData
|
||||
{
|
||||
/**
|
||||
* ID of pet to update
|
||||
*/
|
||||
#[DTA\Data(subset: "path", field: "petId")]
|
||||
#[DTA\Strategy("QueryStringScalar", ["type" => "int"], "path")]
|
||||
#[DTA\Validator("QueryStringScalar", ["type" => "int"], subset: "path")]
|
||||
public int|null $pet_id = null;
|
||||
|
||||
}
|
||||
48
samples/client/petstore/php-dt-modern/src/App/DTO/User.php
Normal file
48
samples/client/petstore/php-dt-modern/src/App/DTO/User.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO;
|
||||
|
||||
use Articus\DataTransfer\PhpAttribute as DTA;
|
||||
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
*/
|
||||
class User
|
||||
{
|
||||
#[DTA\Data(field: "id", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $id = null;
|
||||
|
||||
#[DTA\Data(field: "username", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $username = null;
|
||||
|
||||
#[DTA\Data(field: "firstName", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $first_name = null;
|
||||
|
||||
#[DTA\Data(field: "lastName", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $last_name = null;
|
||||
|
||||
#[DTA\Data(field: "email", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $email = null;
|
||||
|
||||
#[DTA\Data(field: "password", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $password = null;
|
||||
|
||||
#[DTA\Data(field: "phone", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "string"])]
|
||||
public string|null $phone = null;
|
||||
|
||||
/**
|
||||
* User Status
|
||||
*/
|
||||
#[DTA\Data(field: "userStatus", nullable: true)]
|
||||
#[DTA\Validator("Scalar", ["type" => "int"])]
|
||||
public int|null $user_status = null;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user