[php-ze-ph][php-mezzio-ph] Migration from Zend to Laminas and corresponding generator rename (#8145)

* Migration from php-ze-ph to php-mezzio-ph

* Sample regen after rebase

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
Arthur Mogliev 2020-12-20 17:48:37 +04:00 committed by GitHub
parent d1dcdad3d5
commit 206f698a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
198 changed files with 733 additions and 3864 deletions

View File

@ -807,7 +807,7 @@
]
},
{
"input": "php-ze-ph-petstore-server.sh",
"input": "php-mezzio-ph-petstore-server.sh",
"matches": [
"Server: PHP"
]

4
.gitignore vendored
View File

@ -176,12 +176,12 @@ samples/client/petstore/python-tornado/.venv/
# PHP
samples/client/petstore/php/OpenAPIClient-php/composer.lock
samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
samples/openapi3/server/petstore/php-ze-ph/composer.lock
samples/openapi3/server/petstore/php-mezzio-ph/composer.lock
samples/server/petstore/php-laravel/lib/composer.lock
samples/server/petstore/php-lumen/lib/composer.lock
samples/server/petstore/php-slim4/composer.lock
samples/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
samples/server/petstore/php-ze-ph/composer.lock
samples/server/petstore/php-mezzio-ph/composer.lock
# ts
samples/client/petstore/typescript-angular2/npm/npm-debug.log

View File

@ -0,0 +1,4 @@
generatorName: php-mezzio-ph
outputDir: samples/server/petstore/php-mezzio-ph
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/php-mezzio-ph

View File

@ -1,4 +0,0 @@
generatorName: php-ze-ph
outputDir: samples/server/petstore/php-ze-ph
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/php-ze-ph

View File

@ -107,11 +107,11 @@ The following generators are available:
* [nodejs-express-server (beta)](generators/nodejs-express-server.md)
* [php-laravel](generators/php-laravel.md)
* [php-lumen](generators/php-lumen.md)
* [php-mezzio-ph](generators/php-mezzio-ph.md)
* [php-silex-deprecated (deprecated)](generators/php-silex-deprecated.md)
* [php-slim-deprecated (deprecated)](generators/php-slim-deprecated.md)
* [php-slim4](generators/php-slim4.md)
* [php-symfony](generators/php-symfony.md)
* [php-ze-ph](generators/php-ze-ph.md)
* [python-aiohttp](generators/python-aiohttp.md)
* [python-blueplanet](generators/python-blueplanet.md)
* [python-flask](generators/python-flask.md)

View File

@ -96,9 +96,9 @@ The following generators are available:
* [nodejs-express-server (beta)](nodejs-express-server.md)
* [php-laravel](php-laravel.md)
* [php-lumen](php-lumen.md)
* [php-mezzio-ph](php-mezzio-ph.md)
* [php-slim4](php-slim4.md)
* [php-symfony](php-symfony.md)
* [php-ze-ph](php-ze-ph.md)
* [python-aiohttp](python-aiohttp.md)
* [python-blueplanet](python-blueplanet.md)
* [python-flask](python-flask.md)

View File

@ -1,6 +1,6 @@
---
title: Config Options for php-ze-ph
sidebar_label: php-ze-ph
title: Config Options for php-mezzio-ph
sidebar_label: php-mezzio-ph
---
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.

View File

@ -129,7 +129,7 @@ All languages of `swagger-codegen` have been migrated to `openapi-generator`, bu
| `swift` | `swift2-deprecated` |
| `lumen` | `php-lumen` |
| `slim` | `php-slim` |
| `ze-ph` | `php-ze-ph` |
| `ze-ph` | `php-mezzio-ph` |
| `nancyfx` | `csharp-nancyfx` |
We provide a temporary mapping in code for these old values. You'll receive a warning with instructions to migrate to the new names.

View File

@ -33,8 +33,8 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
public class PhpZendExpressivePathHandlerServerCodegen extends AbstractPhpCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(PhpZendExpressivePathHandlerServerCodegen.class);
public class PhpMezzioPathHandlerServerCodegen extends AbstractPhpCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(PhpMezzioPathHandlerServerCodegen.class);
// TODO: Rename to x- prefixed vendor extensions, per specification.
public static final String VEN_FROM_QUERY = "internal.ze-ph.fromQuery";
@ -49,15 +49,15 @@ public class PhpZendExpressivePathHandlerServerCodegen extends AbstractPhpCodege
@Override
public String getName() {
return "php-ze-ph";
return "php-mezzio-ph";
}
@Override
public String getHelp() {
return "Generates PHP server stub using Zend Expressive ( https://zendframework.github.io/zend-expressive ) and Path Handler ( https://github.com/Articus/PathHandler ).";
return "Generates PHP server stub using Mezzio ( https://docs.mezzio.dev/mezzio/ ) and Path Handler ( https://github.com/Articus/PathHandler ).";
}
public PhpZendExpressivePathHandlerServerCodegen() {
public PhpMezzioPathHandlerServerCodegen() {
super();
modifyFeatureSet(features -> features
@ -78,7 +78,7 @@ public class PhpZendExpressivePathHandlerServerCodegen extends AbstractPhpCodege
//no point to use double - http://php.net/manual/en/language.types.float.php , especially because of PHP 7+ float type declaration
typeMapping.put("double", "float");
embeddedTemplateDir = templateDir = "php-ze-ph";
embeddedTemplateDir = templateDir = "php-mezzio-ph";
invokerPackage = "App";
srcBasePath = "src" + File.separator + "App";
apiDirName = "Handler";
@ -101,13 +101,6 @@ public class PhpZendExpressivePathHandlerServerCodegen extends AbstractPhpCodege
supportingFiles.add(new SupportingFile("data_transfer.yml.mustache", "application" + File.separator + "config", "data_transfer.yml"));
supportingFiles.add(new SupportingFile("Factory.php.mustache", srcBasePath, "Factory.php"));
supportingFiles.add(new SupportingFile("InternalServerError.php.mustache", srcBasePath + File.separator + "Middleware", "InternalServerError.php"));
supportingFiles.add(new SupportingFile("Date.php.mustache", srcBasePath + File.separator + "Strategy", "Date.php"));
supportingFiles.add(new SupportingFile("DateTime.php.mustache", srcBasePath + File.separator + "Strategy", "DateTime.php"));
supportingFiles.add(new SupportingFile("QueryParameter.php.mustache", srcBasePath + File.separator + "Strategy", "QueryParameter.php"));
supportingFiles.add(new SupportingFile("QueryParameterArray.php.mustache", srcBasePath + File.separator + "Strategy", "QueryParameterArray.php"));
supportingFiles.add(new SupportingFile("Type.php.mustache", srcBasePath + File.separator + "Validator", "Type.php"));
supportingFiles.add(new SupportingFile("QueryParameterType.php.mustache", srcBasePath + File.separator + "Validator", "QueryParameterType.php"));
supportingFiles.add(new SupportingFile("QueryParameterArrayType.php.mustache", srcBasePath + File.separator + "Validator", "QueryParameterArrayType.php"));
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, "1.0.0");
}

View File

@ -86,7 +86,7 @@ org.openapitools.codegen.languages.PhpSlimServerCodegen
org.openapitools.codegen.languages.PhpSlim4ServerCodegen
org.openapitools.codegen.languages.PhpSilexServerCodegen
org.openapitools.codegen.languages.PhpSymfonyServerCodegen
org.openapitools.codegen.languages.PhpZendExpressivePathHandlerServerCodegen
org.openapitools.codegen.languages.PhpMezzioPathHandlerServerCodegen
org.openapitools.codegen.languages.PowerShellClientCodegen
org.openapitools.codegen.languages.ProtobufSchemaCodegen
org.openapitools.codegen.languages.PythonLegacyClientCodegen

View File

@ -7,17 +7,17 @@ use {{invokerPackage}}\Middleware;
use Interop\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Expressive\Application;
use Zend\Expressive\Handler\NotFoundHandler;
use Zend\Expressive\MiddlewareFactory;
use Zend\Expressive\Router\Middleware\DispatchMiddleware;
use Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware;
use Zend\Expressive\Router\Middleware\RouteMiddleware;
use Zend\Expressive\Router\RouteCollector;
use Zend\HttpHandlerRunner\Emitter\EmitterInterface;
use Zend\HttpHandlerRunner\RequestHandlerRunner;
use Zend\ServiceManager\Factory\FactoryInterface;
use Zend\Stratigility\MiddlewarePipe;
use Mezzio\Application;
use Mezzio\Handler\NotFoundHandler;
use Mezzio\MiddlewareFactory;
use Mezzio\Router\Middleware\DispatchMiddleware;
use Mezzio\Router\Middleware\MethodNotAllowedMiddleware;
use Mezzio\Router\Middleware\RouteMiddleware;
use Mezzio\Router\RouteCollector;
use Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
use Laminas\HttpHandlerRunner\RequestHandlerRunner;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\Stratigility\MiddlewarePipe;
class Factory implements FactoryInterface
{

View File

@ -7,7 +7,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Zend\Stdlib\ErrorHandler;
use Laminas\Stdlib\ErrorHandler;
class InternalServerError implements MiddlewareInterface
{

View File

@ -6,14 +6,14 @@ Generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
This server stub aims to provide light, yet comprehensive structure for your API project using:
- PHP: >=7.2
- [Zend Expressive](https://zendframework.github.io/zend-expressive): >=3.2
- [Path Handler](https://github.com/Articus/PathHandler): >=0.4
- [Laminas Mezzio](https://docs.mezzio.dev/mezzio/): >=3.2
- [Path Handler](https://github.com/Articus/PathHandler): >=0.6
## How to use
All you have to do to start development is:
- install dependencies via [Composer](https://getcomposer.org/) (small note: [ext-yaml](https://pecl.php.net/package/yaml) is used only for configuration parsing, so if you want to drop this dependency, simply adjust `./application/container.php`)
- create cache folder: `mkdir -p ./data/cache/ZendCache` (you will need it later for configuration and metadata caches - check comments in `./application/config.yml`)
- create cache folder: `mkdir -p ./data/cache` (you will need it later for configuration and metadata caches - check comments in `./application/config.yml`)
- start PHP development server: `php -S 0.0.0.0:8080 -t ./public` (or any other SAPI you prefer, just make sure that you configure webroot to `./public` and rewrites to `./public/index.php`)
After that you should be able to call all methods from your API spec. Most of the negative scenarios should be handled:
@ -31,4 +31,4 @@ But for obvious reason you will not get any `200 OK`, only `501 Not implemented`
- implement your handlers - the most tricky part :)
## Enjoy!
Hopefully this stub will reduce the amount of boilerplate code you have to write manually. If you have any suggestions or questions about `php-ze-ph` generator, feel free to create issue either in [Path Handler repository](https://github.com/Articus/PathHandler/issues) or in [OpenAPI Generator repository](https://openapi-generator.tech/issues).
Hopefully this stub will reduce the amount of boilerplate code you have to write manually. If you have any suggestions or questions about `php-mezzio-ph` generator, feel free to create issue either in [Path Handler repository](https://github.com/Articus/PathHandler/issues) or in [OpenAPI Generator repository](https://openapi-generator.tech/issues).

View File

@ -40,7 +40,7 @@ class {{classname}}
{{#bodyParam}}
{{#consumes}}
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="{{{mediaType}}}")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="{{{mediaType}}}")
{{/consumes}}
{{^isPrimitiveType}}
{{#isContainer}}

View File

@ -0,0 +1,22 @@
dependencies:
invokables:
Laminas\HttpHandlerRunner\Emitter\EmitterInterface: Laminas\HttpHandlerRunner\Emitter\SapiStreamEmitter
factories:
Mezzio\Application: App\Factory
Mezzio\MiddlewareContainer: Mezzio\Container\MiddlewareContainerFactory
Mezzio\MiddlewareFactory: Mezzio\Container\MiddlewareFactoryFactory
Mezzio\Router\RouteCollector: Mezzio\Router\RouteCollectorFactory
Psr\Http\Message\ServerRequestInterface: Mezzio\Container\ServerRequestFactoryFactory
Psr\Http\Message\StreamInterface: Mezzio\Container\StreamFactoryFactory
Psr\Http\Message\ResponseInterface: Mezzio\Container\ResponseFactoryFactory
App\Middleware\InternalServerError: Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory
Mezzio\Router\Middleware\RouteMiddleware: Mezzio\Router\Middleware\RouteMiddlewareFactory
Mezzio\Router\Middleware\DispatchMiddleware: Mezzio\Router\Middleware\DispatchMiddlewareFactory
Mezzio\Router\Middleware\MethodNotAllowedMiddleware: Mezzio\Router\Middleware\MethodNotAllowedMiddlewareFactory
Mezzio\Handler\NotFoundHandler: Mezzio\Container\NotFoundHandlerFactory
Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory:
App\Middleware\InternalServerError:
- Psr\Http\Message\ResponseInterface

View File

@ -0,0 +1,27 @@
{
"name": "{{#lambda.lowercase}}{{gitUserId}}/{{gitRepoId}}{{/lambda.lowercase}}",
"description": "{{description}}",
"license": "unlicense",
"version": "{{artifactVersion}}",
"type": "project",
"require": {
"php": "^7.2",
"ext-yaml": "^2.0",
"mezzio/mezzio": "^3.2",
"laminas/laminas-diactoros": "^2.1",
"articus/path-handler": "^0.6",
"articus/data-transfer": "^0.4",
"articus/openapi-generator-common": "^0.1",
"doctrine/annotations": "^1.10",
"psr/simple-cache": "^1.0",
"laminas/laminas-config": "^3.4",
"laminas/laminas-stdlib": "^3.2",
"laminas/laminas-validator": "^2.13",
"nikic/fast-route": "^1.3"
},
"autoload": {
"psr-4": {
"": "src/"
}
}
}

View File

@ -0,0 +1,20 @@
#Empty configuration placeholder, remove when you add any real configuration settings to this file
{}
#Enable configuration cache
#cache_configuration: true
#Articus\PathHandler\RouteInjection\Factory:
# #Enable routing table cache
# router:
# cache:
# directory: ./data/cache/PathHandler
# #Enable handler metadata cache
# metadata:
# cache:
# directory: ./data/cache/PathHandler
#Enable data transfer metadata cache for DTOs
#Articus\DataTransfer\MetadataProvider\Annotation:
# cache:
# directory: ./data/cache/DataTransfer

View File

@ -1,7 +1,7 @@
<?php
declare(strict_types=1);
use Zend\Config\Factory as ConfigFactory;
use Laminas\Config\Factory as ConfigFactory;
//Use Composer autoload that includes code both from ../src and ../vendor
require __DIR__ . '/../vendor/autoload.php';
@ -37,7 +37,7 @@ if (is_readable(CONFIG_CACHE_PATH)) {
}
//Create container
$container = new \Zend\ServiceManager\ServiceManager($config['dependencies'] ?? []);
$container = new \Laminas\ServiceManager\ServiceManager($config['dependencies'] ?? []);
//Register full configuration as a service
$container->setService('config', $config);

View File

@ -0,0 +1,26 @@
dependencies:
factories:
Articus\DataTransfer\Service: Articus\DataTransfer\Factory
Articus\DataTransfer\MetadataProvider\Annotation: Articus\DataTransfer\MetadataProvider\Factory\Annotation
Articus\DataTransfer\Strategy\PluginManager: Articus\DataTransfer\Strategy\Factory\PluginManager
Articus\DataTransfer\Validator\PluginManager: Articus\DataTransfer\Validator\Factory\PluginManager
Laminas\Validator\ValidatorPluginManager: Laminas\Validator\ValidatorPluginManagerFactory
aliases:
Articus\DataTransfer\ClassMetadataProviderInterface: Articus\DataTransfer\MetadataProvider\Annotation
Articus\DataTransfer\FieldMetadataProviderInterface: Articus\DataTransfer\MetadataProvider\Annotation
Articus\DataTransfer\Strategy\PluginManager:
invokables:
QueryStringScalar: OpenAPIGenerator\Common\Strategy\QueryStringScalar
QueryStringScalarArray: OpenAPIGenerator\Common\Strategy\QueryStringScalarArray
factories:
Date: OpenAPIGenerator\Common\Strategy\Factory\MutableDate
DateTime: OpenAPIGenerator\Common\Strategy\Factory\MutableDateTime
Articus\DataTransfer\Validator\PluginManager:
invokables:
Scalar: OpenAPIGenerator\Common\Validator\Scalar
QueryStringScalar: OpenAPIGenerator\Common\Validator\QueryStringScalar
QueryStringScalarArray: OpenAPIGenerator\Common\Validator\QueryStringScalarArray
abstract_factories:
- Articus\DataTransfer\Validator\Factory\Laminas

View File

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
chdir(dirname(__DIR__));
/** @var \Laminas\ServiceManager\ServiceManager $container */
$container = require_once __DIR__.'/../application/container.php';
/** @var \Mezzio\Application $app */
$app = $container->get(\Mezzio\Application::class);
$app->run();

View File

@ -20,7 +20,7 @@ class {{classname}}
* @DTA\Data(field="{{baseName}}"{{^required}}, nullable=true{{/required}}){{#vendorExtensions}}{{#internal.ze-ph.fromQuery}}
{{>model_query_var}}{{/internal.ze-ph.fromQuery}}{{/vendorExtensions}}{{#vendorExtensions}}{{^internal.ze-ph.fromQuery}}
{{>model_normal_var}}{{/internal.ze-ph.fromQuery}}{{/vendorExtensions}}{{^vendorExtensions}}
{{>model_normal_var}}{{/vendorExtensions}} * @var {{dataType}}
{{>model_normal_var}}{{/vendorExtensions}} * @var {{dataType}}|null
*/
public ${{name}};
{{/vars}}

View File

@ -3,7 +3,7 @@
{{^isDate}}
{{^isDateTime}}
* @DTA\Strategy(name="Object", options={"type":{{dataType}}::class})
* @DTA\Validator(name="Dictionary", options={"type":{{dataType}}::class})
* @DTA\Validator(name="TypeCompliant", options={"type":{{dataType}}::class})
{{/isDateTime}}
{{/isDate}}
{{#isDate}}
@ -19,7 +19,7 @@
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="ObjectArray", options={"type":{{#items}}{{dataType}}{{/items}}::class})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Dictionary", "options":{"type":{{#items}}{{dataType}}{{/items}}::class}}
* {"name":"TypeCompliant", "options":{"type":{{#items}}{{dataType}}{{/items}}::class}}
* }})
{{/isContainer}}
{{/isPrimitiveType}}
@ -28,12 +28,12 @@
{{#items}}
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Type", "options":{"type":"{{dataType}}"}}
* {"name":"Scalar", "options":{"type":"{{dataType}}"}}
* }})
{{/items}}
{{/isContainer}}
{{^isContainer}}
* @DTA\Validator(name="Type", options={"type":"{{dataType}}"})
* @DTA\Validator(name="Scalar", options={"type":"{{dataType}}"})
{{/isContainer}}
{{/isPrimitiveType}}
{{#hasValidation}}

View File

@ -15,15 +15,13 @@
{{/isPrimitiveType}}
{{#isPrimitiveType}}
{{#isContainer}}
{{#items}}
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="QueryParameterArray", options={"type":"{{dataType}}", "format":"{{internal.ze-ph.collectionFormat}}"})
* @DTA\Validator(name="QueryParameterArrayType", options={"type":"{{dataType}}", "format":"{{internal.ze-ph.collectionFormat}}"})
{{/items}}
* @DTA\Strategy(name="QueryStringScalarArray", options={"type":"{{#items}}{{dataType}}{{/items}}", "format":"{{internal.ze-ph.collectionFormat}}"})
* @DTA\Validator(name="QueryStringScalarArray", options={"type":"{{#items}}{{dataType}}{{/items}}", "format":"{{internal.ze-ph.collectionFormat}}"{{#minItems}}, "min_items":{{minItems}}{{/minItems}}{{#maxItems}}, "max_items":{{maxItems}}{{/maxItems}}})
{{/isContainer}}
{{^isContainer}}
* @DTA\Strategy(name="QueryParameter", options={"type":"{{dataType}}"})
* @DTA\Validator(name="QueryParameterType", options={"type":"{{dataType}}"})
* @DTA\Strategy(name="QueryStringScalar", options={"type":"{{dataType}}"})
* @DTA\Validator(name="QueryStringScalar", options={"type":"{{dataType}}"})
{{/isContainer}}
{{/isPrimitiveType}}
{{#hasValidation}}

View File

@ -1,3 +1,7 @@
dependencies:
factories:
Mezzio\Router\RouterInterface: Articus\PathHandler\RouteInjection\Factory
Articus\PathHandler\RouteInjection\Factory:
paths:
'{{basePathWithoutHost}}':
@ -10,7 +14,7 @@ Articus\PathHandler\RouteInjection\Factory:
{{/apiInfo}}
handlers:
abstract_factories:
- Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory
- Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory
# consumers:
# factories:
# invokables:
@ -21,7 +25,7 @@ Articus\PathHandler\RouteInjection\Factory:
# factories:
# invokables:
Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory:
Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory:
{{#apiInfo}}
{{#apis}}
{{#operations}}

View File

@ -1,21 +0,0 @@
<?php
declare(strict_types=1);
namespace {{invokerPackage}}\Strategy;
class Date extends DateTime
{
const DATE_TIME_FORMAT = 'Y-m-d';
/**
* @inheritdoc
*/
protected function parseDateString($arrayValue)
{
return \DateTime::createFromFormat(
static::DATE_TIME_FORMAT . ' H:i:sP',
$arrayValue . ' 00:00:00+00:00',
new \DateTimeZone('UTC')
);
}
}

View File

@ -1,47 +0,0 @@
<?php
declare(strict_types=1);
namespace {{invokerPackage}}\Strategy;
use Articus\DataTransfer\Strategy\StrategyInterface;
class DateTime implements StrategyInterface
{
const DATE_TIME_FORMAT = \DateTime::RFC3339;
/**
* @inheritdoc
*/
public function extract($objectValue, $object = null)
{
$result = null;
if ($objectValue instanceof \DateTime) {
$result = $objectValue->format(static::DATE_TIME_FORMAT);
}
return $result;
}
/**
* @inheritdoc
*/
public function hydrate($arrayValue, $objectValue, array $array = null)
{
$result = null;
if (!empty($arrayValue)) {
$date = $this->parseDateString($arrayValue);
if ($date instanceof \DateTime) {
$result = $date;
}
}
return $result;
}
/**
* @param $arrayValue
* @return bool|\DateTime
*/
protected function parseDateString($arrayValue)
{
return \DateTime::createFromFormat(static::DATE_TIME_FORMAT, $arrayValue, new \DateTimeZone('UTC'));
}
}

View File

@ -1,77 +0,0 @@
<?php
declare(strict_types=1);
namespace {{invokerPackage}}\Strategy;
use Articus\DataTransfer\Strategy\StrategyInterface;
class QueryParameter implements StrategyInterface
{
const TYPE_INT = 'int';
const TYPE_FLOAT = 'float';
const TYPE_BOOL = 'bool';
const TYPE_STRING = 'string';
const TYPE_MAP = [
self::TYPE_INT => true,
self::TYPE_FLOAT => true,
self::TYPE_BOOL => true,
self::TYPE_STRING => true,
];
/**
* @var string
*/
protected $type;
/**
* QueryParameterArray constructor.
*/
public function __construct(array $options)
{
if (empty($options['type'])) {
throw new \InvalidArgumentException('Option "type" is required.');
} elseif (!isset(self::TYPE_MAP[$options['type']])) {
throw new \InvalidArgumentException(\sprintf('Unknown type "%s".', $options['type']));
}
$this->type = $options['type'];
}
/**
* @inheritdoc
*/
public function extract($objectValue, $object = null)
{
$result = null;
if ($objectValue !== null) {
$result = (string)$objectValue;
}
return $result;
}
/**
* @inheritdoc
*/
public function hydrate($arrayValue, $objectValue, array $array = null)
{
$result = null;
if ($arrayValue !== null) {
switch ($this->type) {
case self::TYPE_INT:
$result = (int)$arrayValue;
break;
case self::TYPE_FLOAT:
$result = (float)$arrayValue;
break;
case self::TYPE_BOOL:
$result = ($arrayValue === 'true')? true : false;
break;
case self::TYPE_STRING:
$result = (string)$arrayValue;
break;
}
}
return $result;
}
}

View File

@ -1,74 +0,0 @@
<?php
declare(strict_types=1);
namespace {{invokerPackage}}\Strategy;
class QueryParameterArray extends QueryParameter
{
const FORMAT_CSV = 'csv'; //comma separated values foo,bar.
const FORMAT_SSV = 'ssv'; //space separated values foo bar.
const FORMAT_TSV = 'tsv'; //tab separated values foo\tbar.
const FORMAT_PIPES = 'pipes'; //pipe separated values foo|bar.
const FORMAT_MULTI = 'multi'; //corresponds to multiple parameter instances instead of multiple values for a single instance foo[]=bar&foo[]=baz.
const DELIMITER_MAP = [
self::FORMAT_CSV => ',',
self::FORMAT_SSV => ' ',
self::FORMAT_TSV => "\t",
self::FORMAT_PIPES => '|',
self::FORMAT_MULTI => null,
];
/**
* @var string|null
*/
protected $delimiter;
public function __construct(array $options)
{
parent::__construct($options);
if (empty($options['format'])) {
throw new \InvalidArgumentException('Option "format" is required.');
} elseif (!\array_key_exists($options['format'], self::DELIMITER_MAP)) {
throw new \InvalidArgumentException(\sprintf('Unknown format "%s".', $options['format']));
}
$this->delimiter = self::DELIMITER_MAP[$options['format']];
}
/**
* @inheritdoc
*/
public function extract($objectValue, $object = null)
{
$result = null;
if (\is_array($objectValue)) {
if ($this->delimiter === null) {
$result = $objectValue;
} else {
$result = \implode($this->delimiter, $objectValue);
}
}
return $result;
}
/**
* @inheritdoc
*/
public function hydrate($arrayValue, $objectValue, array $array = null)
{
$result = null;
if ($arrayValue !== null) {
$list = null;
if ($this->delimiter === null) {
$list = (\is_array($arrayValue))? $arrayValue : [$arrayValue];
} else {
$list = \explode($this->delimiter, $arrayValue);
}
$result = [];
foreach ($list as $item) {
$result[] = parent::hydrate($item, null);
}
}
return $result;
}
}

View File

@ -1,74 +0,0 @@
<?php
declare(strict_types=1);
namespace {{invokerPackage}}\Validator;
use App\Strategy\QueryParameterArray;
class QueryParameterArrayType extends QueryParameterType
{
/**
* @var null|string
*/
protected $format;
/**
* @return string
*/
public function getFormat(): ?string
{
return $this->format;
}
/**
* @param string $format
* @return self
*/
public function setFormat(string $format): self
{
$this->format = $format;
return $this;
}
protected function checkType($value): bool
{
$result = true;
if (!\array_key_exists($this->format, QueryParameterArray::DELIMITER_MAP)) {
throw new \InvalidArgumentException(\sprintf('Can not check for format %s.', $this->format));
}
$delimiter = QueryParameterArray::DELIMITER_MAP[$this->format];
if ($delimiter === null) {
if (\is_array($value)) {
foreach ($value as $item) {
$result = $result && parent::checkType($item);
}
} else {
$result = false;
}
} else {
switch ($this->type) {
case QueryParameterArray::TYPE_INT:
$result = \is_string($value) && \preg_match(self::prepareRepeatingTypeRegExp(self::RE_INT, $delimiter), $value);
break;
case QueryParameterArray::TYPE_BOOL:
$result = \is_string($value) && \preg_match(self::prepareRepeatingTypeRegExp(self::RE_BOOL, $delimiter), $value);
break;
case QueryParameterArray::TYPE_FLOAT:
$result = \is_string($value) && \preg_match(self::prepareRepeatingTypeRegExp(self::RE_FLOAT, $delimiter), $value);
break;
case QueryParameterArray::TYPE_STRING:
$result = \is_string($value);
break;
default:
throw new \InvalidArgumentException(\sprintf('Can not check for type %s.', $this->type));
}
}
return $result;
}
protected static function prepareRepeatingTypeRegExp(string $typeRegExp, string $delimiter): string
{
$escapedDelimiter = \preg_quote($delimiter, '/');
return '/^(' . $typeRegExp . ')(' . $escapedDelimiter . '('. $typeRegExp . '))*$/';
}
}

View File

@ -1,29 +0,0 @@
<?php
declare(strict_types=1);
namespace {{invokerPackage}}\Validator;
use App\Strategy\QueryParameter;
class QueryParameterType extends Type
{
const RE_INT = '0|-?[1-9]\d*';
const RE_BOOL = 'true|false';
const RE_FLOAT = '0(\.\d+)?|-?[1-9]\d*(\.\d+)?|-0\.\d+';
protected function checkType($value): bool
{
switch ($this->type) {
case QueryParameter::TYPE_INT:
return \is_string($value) && \preg_match('/^(' . self::RE_INT . ')$/', $value);
case QueryParameter::TYPE_BOOL:
return \is_string($value) && \preg_match('/^(' . self::RE_BOOL . ')$/', $value);
case QueryParameter::TYPE_FLOAT:
return \is_string($value) && \preg_match('/^(' . self::RE_FLOAT . ')$/', $value);
case QueryParameter::TYPE_STRING:
return \is_string($value);
default:
throw new \InvalidArgumentException(\sprintf('Can not check for type %s.', $this->type));
}
}
}

View File

@ -1,73 +0,0 @@
<?php
declare(strict_types=1);
namespace {{invokerPackage}}\Validator;
use Zend\Validator\AbstractValidator;
use Zend\Validator\Exception;
class Type extends AbstractValidator
{
const INVALID = 'typeInvalid';
/**
* Validation failure message template definitions
*
* @var array
*/
protected $messageTemplates = [
self::INVALID => 'Invalid type given.',
];
/**
* @var null|string
*/
protected $type;
/**
* @return string
*/
public function getType(): ?string
{
return $this->type;
}
/**
* @param string $type
* @return self
*/
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
/**
* @inheritdoc
*/
public function isValid($value)
{
$result = true;
if (!$this->checkType($value)) {
$this->error(self::INVALID);
$result = false;
}
return $result;
}
protected function checkType($value): bool
{
switch ($this->type) {
case 'int':
return \is_int($value);
case 'bool':
return \is_bool($value);
case 'float':
return \is_float($value) || \is_int($value);
case 'string':
return \is_string($value);
default:
throw new \InvalidArgumentException(\sprintf('Can not check for type %s.', $this->type));
}
}
}

View File

@ -1,23 +0,0 @@
dependencies:
invokables:
Zend\HttpHandlerRunner\Emitter\EmitterInterface: Zend\HttpHandlerRunner\Emitter\SapiStreamEmitter
factories:
Zend\Expressive\Application: App\Factory
Zend\Expressive\MiddlewareContainer: Zend\Expressive\Container\MiddlewareContainerFactory
Zend\Expressive\MiddlewareFactory: Zend\Expressive\Container\MiddlewareFactoryFactory
Zend\Expressive\Router\RouteCollector: Zend\Expressive\Router\RouteCollectorFactory
Zend\Expressive\Router\RouterInterface: Articus\PathHandler\RouteInjection\Factory
Psr\Http\Message\ServerRequestInterface: Zend\Expressive\Container\ServerRequestFactoryFactory
Psr\Http\Message\StreamInterface: Zend\Expressive\Container\StreamFactoryFactory
Psr\Http\Message\ResponseInterface: Zend\Expressive\Container\ResponseFactoryFactory
Zend\Expressive\Router\Middleware\RouteMiddleware: Zend\Expressive\Router\Middleware\RouteMiddlewareFactory
Zend\Expressive\Router\Middleware\DispatchMiddleware: Zend\Expressive\Router\Middleware\DispatchMiddlewareFactory
Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware: Zend\Expressive\Router\Middleware\MethodNotAllowedMiddlewareFactory
Zend\Expressive\Handler\NotFoundHandler: Zend\Expressive\Container\NotFoundHandlerFactory
App\Middleware\InternalServerError: Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory
Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory:
App\Middleware\InternalServerError:
- Psr\Http\Message\ResponseInterface

View File

@ -1,25 +0,0 @@
{
"name": "{{gitUserId}}/{{gitRepoId}}",
"description": "{{description}}",
"license": "unlicense",
"version": "{{artifactVersion}}",
"type": "project",
"require": {
"php": "^7.2",
"ext-yaml": "^2.0",
"zendframework/zend-expressive": "^3.2",
"zendframework/zend-diactoros": "^2.1",
"articus/path-handler": "^0.4",
"articus/data-transfer": "^0.2",
"doctrine/annotations": "^1.6",
"zendframework/zend-cache": "^2.8",
"zendframework/zend-serializer": "^2.9",
"zendframework/zend-config": "^3.2",
"nikic/fast-route": "^1.3"
},
"autoload": {
"psr-4": {
"": "src/"
}
}
}

View File

@ -1,39 +0,0 @@
#Empty configuration placeholder, remove when you add any real configuration settings to this file
{}
#Enable configuration cache
#cache_configuration: true
#Articus\PathHandler\RouteInjection\Factory:
# #Enable routing table cache
# router:
# cache:
# adapter: filesystem
# options:
# cache_dir: data/cache/ZendCache
# namespace: ph-router
# plugins:
# serializer:
# serializer: phpserialize
# #Enable handler metadata cache
# metadata:
# cache:
# adapter: filesystem
# options:
# cache_dir: data/cache/ZendCache
# namespace: ph-metadata
# plugins:
# serializer:
# serializer: phpserialize
#Enable data transfer metadata cache for DTOs
#Articus\DataTransfer\Service:
# metadata_cache:
# adapter:
# name: filesystem
# options:
# cache_dir: data/cache/ZendCache
# namespace: dt
# plugins:
# serializer:
# serializer: phpserialize

View File

@ -1,33 +0,0 @@
dependencies:
factories:
Articus\DataTransfer\Service: Articus\DataTransfer\ServiceFactory
Articus\DataTransfer\Service:
metadata_cache:
adapter:
name: blackhole
strategies:
invokables:
{{invokerPackage}}\Strategy\Date: {{invokerPackage}}\Strategy\Date
{{invokerPackage}}\Strategy\DateTime: {{invokerPackage}}\Strategy\DateTime
{{invokerPackage}}\Strategy\QueryParameter: {{invokerPackage}}\Strategy\QueryParameter
{{invokerPackage}}\Strategy\QueryParameterArray: {{invokerPackage}}\Strategy\QueryParameterArray
aliases:
Date: {{invokerPackage}}\Strategy\Date
DateTime: {{invokerPackage}}\Strategy\DateTime
QueryParameter: {{invokerPackage}}\Strategy\QueryParameter
QueryParameterArray: {{invokerPackage}}\Strategy\QueryParameterArray
validators:
invokables:
{{invokerPackage}}\Validator\Type: {{invokerPackage}}\Validator\Type
{{invokerPackage}}\Validator\QueryParameterType: {{invokerPackage}}\Validator\QueryParameterType
{{invokerPackage}}\Validator\QueryParameterArrayType: {{invokerPackage}}\Validator\QueryParameterArrayType
factories:
Articus\DataTransfer\Validator\Dictionary: Articus\DataTransfer\Validator\Factory
Articus\DataTransfer\Validator\Collection: Articus\DataTransfer\Validator\Factory
aliases:
Dictionary: Articus\DataTransfer\Validator\Dictionary
Collection: Articus\DataTransfer\Validator\Collection
Type: {{invokerPackage}}\Validator\Type
QueryParameterType: {{invokerPackage}}\Validator\QueryParameterType
QueryParameterArrayType: {{invokerPackage}}\Validator\QueryParameterArrayType

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
chdir(dirname(__DIR__));
/** @var \Zend\ServiceManager\ServiceManager $container */
$container = require_once __DIR__.'/../application/container.php';
/** @var \Zend\Expressive\Application $app */
$app = $container->get(\Zend\Expressive\Application::class);
$app->run();

View File

@ -11,6 +11,8 @@ src/App/DTO/ApiResponse.php
src/App/DTO/Category.php
src/App/DTO/FindPetsByStatusQueryData.php
src/App/DTO/FindPetsByTagsQueryData.php
src/App/DTO/InlineObject.php
src/App/DTO/InlineObject1.php
src/App/DTO/LoginUserQueryData.php
src/App/DTO/Order.php
src/App/DTO/Pet.php
@ -32,10 +34,3 @@ src/App/Handler/UserLogin.php
src/App/Handler/UserLogout.php
src/App/Handler/UserUsername.php
src/App/Middleware/InternalServerError.php
src/App/Strategy/Date.php
src/App/Strategy/DateTime.php
src/App/Strategy/QueryParameter.php
src/App/Strategy/QueryParameterArray.php
src/App/Validator/QueryParameterArrayType.php
src/App/Validator/QueryParameterType.php
src/App/Validator/Type.php

View File

@ -6,14 +6,14 @@ Generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
This server stub aims to provide light, yet comprehensive structure for your API project using:
- PHP: >=7.2
- [Zend Expressive](https://zendframework.github.io/zend-expressive): >=3.2
- [Path Handler](https://github.com/Articus/PathHandler): >=0.4
- [Laminas Mezzio](https://docs.mezzio.dev/mezzio/): >=3.2
- [Path Handler](https://github.com/Articus/PathHandler): >=0.6
## How to use
All you have to do to start development is:
- install dependencies via [Composer](https://getcomposer.org/) (small note: [ext-yaml](https://pecl.php.net/package/yaml) is used only for configuration parsing, so if you want to drop this dependency, simply adjust `./application/container.php`)
- create cache folder: `mkdir -p ./data/cache/ZendCache` (you will need it later for configuration and metadata caches - check comments in `./application/config.yml`)
- create cache folder: `mkdir -p ./data/cache` (you will need it later for configuration and metadata caches - check comments in `./application/config.yml`)
- start PHP development server: `php -S 0.0.0.0:8080 -t ./public` (or any other SAPI you prefer, just make sure that you configure webroot to `./public` and rewrites to `./public/index.php`)
After that you should be able to call all methods from your API spec. Most of the negative scenarios should be handled:
@ -31,4 +31,4 @@ But for obvious reason you will not get any `200 OK`, only `501 Not implemented`
- implement your handlers - the most tricky part :)
## Enjoy!
Hopefully this stub will reduce the amount of boilerplate code you have to write manually. If you have any suggestions or questions about `php-ze-ph` generator, feel free to create issue either in [Path Handler repository](https://github.com/Articus/PathHandler/issues) or in [OpenAPI Generator repository](https://openapi-generator.tech/issues).
Hopefully this stub will reduce the amount of boilerplate code you have to write manually. If you have any suggestions or questions about `php-mezzio-ph` generator, feel free to create issue either in [Path Handler repository](https://github.com/Articus/PathHandler/issues) or in [OpenAPI Generator repository](https://openapi-generator.tech/issues).

View File

@ -0,0 +1,20 @@
#Empty configuration placeholder, remove when you add any real configuration settings to this file
{}
#Enable configuration cache
#cache_configuration: true
#Articus\PathHandler\RouteInjection\Factory:
# #Enable routing table cache
# router:
# cache:
# directory: ./data/cache/PathHandler
# #Enable handler metadata cache
# metadata:
# cache:
# directory: ./data/cache/PathHandler
#Enable data transfer metadata cache for DTOs
#Articus\DataTransfer\MetadataProvider\Annotation:
# cache:
# directory: ./data/cache/DataTransfer

View File

@ -0,0 +1,22 @@
dependencies:
invokables:
Laminas\HttpHandlerRunner\Emitter\EmitterInterface: Laminas\HttpHandlerRunner\Emitter\SapiStreamEmitter
factories:
Mezzio\Application: App\Factory
Mezzio\MiddlewareContainer: Mezzio\Container\MiddlewareContainerFactory
Mezzio\MiddlewareFactory: Mezzio\Container\MiddlewareFactoryFactory
Mezzio\Router\RouteCollector: Mezzio\Router\RouteCollectorFactory
Psr\Http\Message\ServerRequestInterface: Mezzio\Container\ServerRequestFactoryFactory
Psr\Http\Message\StreamInterface: Mezzio\Container\StreamFactoryFactory
Psr\Http\Message\ResponseInterface: Mezzio\Container\ResponseFactoryFactory
App\Middleware\InternalServerError: Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory
Mezzio\Router\Middleware\RouteMiddleware: Mezzio\Router\Middleware\RouteMiddlewareFactory
Mezzio\Router\Middleware\DispatchMiddleware: Mezzio\Router\Middleware\DispatchMiddlewareFactory
Mezzio\Router\Middleware\MethodNotAllowedMiddleware: Mezzio\Router\Middleware\MethodNotAllowedMiddlewareFactory
Mezzio\Handler\NotFoundHandler: Mezzio\Container\NotFoundHandlerFactory
Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory:
App\Middleware\InternalServerError:
- Psr\Http\Message\ResponseInterface

View File

@ -0,0 +1,26 @@
dependencies:
factories:
Articus\DataTransfer\Service: Articus\DataTransfer\Factory
Articus\DataTransfer\MetadataProvider\Annotation: Articus\DataTransfer\MetadataProvider\Factory\Annotation
Articus\DataTransfer\Strategy\PluginManager: Articus\DataTransfer\Strategy\Factory\PluginManager
Articus\DataTransfer\Validator\PluginManager: Articus\DataTransfer\Validator\Factory\PluginManager
Laminas\Validator\ValidatorPluginManager: Laminas\Validator\ValidatorPluginManagerFactory
aliases:
Articus\DataTransfer\ClassMetadataProviderInterface: Articus\DataTransfer\MetadataProvider\Annotation
Articus\DataTransfer\FieldMetadataProviderInterface: Articus\DataTransfer\MetadataProvider\Annotation
Articus\DataTransfer\Strategy\PluginManager:
invokables:
QueryStringScalar: OpenAPIGenerator\Common\Strategy\QueryStringScalar
QueryStringScalarArray: OpenAPIGenerator\Common\Strategy\QueryStringScalarArray
factories:
Date: OpenAPIGenerator\Common\Strategy\Factory\MutableDate
DateTime: OpenAPIGenerator\Common\Strategy\Factory\MutableDateTime
Articus\DataTransfer\Validator\PluginManager:
invokables:
Scalar: OpenAPIGenerator\Common\Validator\Scalar
QueryStringScalar: OpenAPIGenerator\Common\Validator\QueryStringScalar
QueryStringScalarArray: OpenAPIGenerator\Common\Validator\QueryStringScalarArray
abstract_factories:
- Articus\DataTransfer\Validator\Factory\Laminas

View File

@ -1,3 +1,7 @@
dependencies:
factories:
Mezzio\Router\RouterInterface: Articus\PathHandler\RouteInjection\Factory
Articus\PathHandler\RouteInjection\Factory:
paths:
'/v2':
@ -17,7 +21,7 @@ Articus\PathHandler\RouteInjection\Factory:
- App\Handler\UserUsername
handlers:
abstract_factories:
- Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory
- Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory
# consumers:
# factories:
# invokables:
@ -28,7 +32,7 @@ Articus\PathHandler\RouteInjection\Factory:
# factories:
# invokables:
Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory:
Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory:
App\Handler\Pet: []
App\Handler\PetFindByStatus: []
App\Handler\PetFindByTags: []

View File

@ -1,7 +1,7 @@
<?php
declare(strict_types=1);
use Zend\Config\Factory as ConfigFactory;
use Laminas\Config\Factory as ConfigFactory;
//Use Composer autoload that includes code both from ../src and ../vendor
require __DIR__ . '/../vendor/autoload.php';
@ -37,7 +37,7 @@ if (is_readable(CONFIG_CACHE_PATH)) {
}
//Create container
$container = new \Zend\ServiceManager\ServiceManager($config['dependencies'] ?? []);
$container = new \Laminas\ServiceManager\ServiceManager($config['dependencies'] ?? []);
//Register full configuration as a service
$container->setService('config', $config);

View File

@ -0,0 +1,27 @@
{
"name": "git_user_id/git_repo_id",
"description": "",
"license": "unlicense",
"version": "1.0.0",
"type": "project",
"require": {
"php": "^7.2",
"ext-yaml": "^2.0",
"mezzio/mezzio": "^3.2",
"laminas/laminas-diactoros": "^2.1",
"articus/path-handler": "^0.6",
"articus/data-transfer": "^0.4",
"articus/openapi-generator-common": "^0.1",
"doctrine/annotations": "^1.10",
"psr/simple-cache": "^1.0",
"laminas/laminas-config": "^3.4",
"laminas/laminas-stdlib": "^3.2",
"laminas/laminas-validator": "^2.13",
"nikic/fast-route": "^1.3"
},
"autoload": {
"psr-4": {
"": "src/"
}
}
}

View File

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
chdir(dirname(__DIR__));
/** @var \Laminas\ServiceManager\ServiceManager $container */
$container = require_once __DIR__.'/../application/container.php';
/** @var \Mezzio\Application $app */
$app = $container->get(\Mezzio\Application::class);
$app->run();

View File

@ -12,20 +12,20 @@ class ApiResponse
{
/**
* @DTA\Data(field="code", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $code;
/**
* @DTA\Data(field="type", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $type;
/**
* @DTA\Data(field="message", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $message;
}

View File

@ -12,15 +12,15 @@ class Category
{
/**
* @DTA\Data(field="id", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $id;
/**
* @DTA\Data(field="name", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @DTA\Validator(name="Regex", options={"pattern":"/^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$/"})
* @var string
* @var string|null
*/
public $name;
}

View File

@ -14,9 +14,9 @@ class FindPetsByStatusQueryData
* Status values that need to be considered for filter
* @DTA\Data(field="status")
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="QueryParameterArray", options={"type":"string", "format":"csv"})
* @DTA\Validator(name="QueryParameterArrayType", options={"type":"string", "format":"csv"})
* @var string[]
* @DTA\Strategy(name="QueryStringScalarArray", options={"type":"string", "format":"csv"})
* @DTA\Validator(name="QueryStringScalarArray", options={"type":"string", "format":"csv"})
* @var string[]|null
*/
public $status;
}

View File

@ -14,9 +14,9 @@ class FindPetsByTagsQueryData
* Tags to filter by
* @DTA\Data(field="tags")
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="QueryParameterArray", options={"type":"string", "format":"csv"})
* @DTA\Validator(name="QueryParameterArrayType", options={"type":"string", "format":"csv"})
* @var string[]
* @DTA\Strategy(name="QueryStringScalarArray", options={"type":"string", "format":"csv"})
* @DTA\Validator(name="QueryStringScalarArray", options={"type":"string", "format":"csv"})
* @var string[]|null
*/
public $tags;
}

View File

@ -12,15 +12,15 @@ class InlineObject
/**
* Updated name of the pet
* @DTA\Data(field="name", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $name;
/**
* Updated status of the pet
* @DTA\Data(field="status", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $status;
}

View File

@ -12,16 +12,16 @@ class InlineObject1
/**
* Additional data to pass to server
* @DTA\Data(field="additionalMetadata", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $additional_metadata;
/**
* file to upload
* @DTA\Data(field="file", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\SplFileObject::class})
* @DTA\Validator(name="Dictionary", options={"type":\SplFileObject::class})
* @var \SplFileObject
* @DTA\Validator(name="TypeCompliant", options={"type":\SplFileObject::class})
* @var \SplFileObject|null
*/
public $file;
}

View File

@ -13,18 +13,18 @@ class LoginUserQueryData
/**
* The password for login in clear text
* @DTA\Data(field="password")
* @DTA\Strategy(name="QueryParameter", options={"type":"string"})
* @DTA\Validator(name="QueryParameterType", options={"type":"string"})
* @var string
* @DTA\Strategy(name="QueryStringScalar", options={"type":"string"})
* @DTA\Validator(name="QueryStringScalar", options={"type":"string"})
* @var string|null
*/
public $password;
/**
* The user name for login
* @DTA\Data(field="username")
* @DTA\Strategy(name="QueryParameter", options={"type":"string"})
* @DTA\Validator(name="QueryParameterType", options={"type":"string"})
* @DTA\Strategy(name="QueryStringScalar", options={"type":"string"})
* @DTA\Validator(name="QueryStringScalar", options={"type":"string"})
* @DTA\Validator(name="Regex", options={"pattern":"/^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$/"})
* @var string
* @var string|null
*/
public $username;
}

View File

@ -12,40 +12,40 @@ class Order
{
/**
* @DTA\Data(field="id", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $id;
/**
* @DTA\Data(field="petId", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $pet_id;
/**
* @DTA\Data(field="quantity", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $quantity;
/**
* @DTA\Data(field="shipDate", nullable=true)
* @DTA\Strategy(name="DateTime")
* @DTA\Validator(name="Date", options={"format": \DateTime::RFC3339})
* @var \DateTime
* @var \DateTime|null
*/
public $ship_date;
/**
* Order Status
* @DTA\Data(field="status", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $status;
/**
* @DTA\Data(field="complete", nullable=true)
* @DTA\Validator(name="Type", options={"type":"bool"})
* @var bool
* @DTA\Validator(name="Scalar", options={"type":"bool"})
* @var bool|null
*/
public $complete;
}

View File

@ -12,30 +12,30 @@ class Pet
{
/**
* @DTA\Data(field="id", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $id;
/**
* @DTA\Data(field="category", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\Category::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\Category::class})
* @var \App\DTO\Category
* @DTA\Validator(name="TypeCompliant", options={"type":\App\DTO\Category::class})
* @var \App\DTO\Category|null
*/
public $category;
/**
* @DTA\Data(field="name")
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $name;
/**
* @DTA\Data(field="photoUrls")
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Type", "options":{"type":"string"}}
* {"name":"Scalar", "options":{"type":"string"}}
* }})
* @var string[]
* @var string[]|null
*/
public $photo_urls;
/**
@ -43,16 +43,16 @@ class Pet
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="ObjectArray", options={"type":\App\DTO\Tag::class})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Dictionary", "options":{"type":\App\DTO\Tag::class}}
* {"name":"TypeCompliant", "options":{"type":\App\DTO\Tag::class}}
* }})
* @var \App\DTO\Tag[]
* @var \App\DTO\Tag[]|null
*/
public $tags;
/**
* pet status in the store
* @DTA\Data(field="status", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $status;
}

View File

@ -12,14 +12,14 @@ class Tag
{
/**
* @DTA\Data(field="id", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $id;
/**
* @DTA\Data(field="name", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $name;
}

View File

@ -12,51 +12,51 @@ class User
{
/**
* @DTA\Data(field="id", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $id;
/**
* @DTA\Data(field="username", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $username;
/**
* @DTA\Data(field="firstName", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $first_name;
/**
* @DTA\Data(field="lastName", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $last_name;
/**
* @DTA\Data(field="email", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $email;
/**
* @DTA\Data(field="password", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $password;
/**
* @DTA\Data(field="phone", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $phone;
/**
* User Status
* @DTA\Data(field="userStatus", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $user_status;
}

View File

@ -7,17 +7,17 @@ use App\Middleware;
use Interop\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Expressive\Application;
use Zend\Expressive\Handler\NotFoundHandler;
use Zend\Expressive\MiddlewareFactory;
use Zend\Expressive\Router\Middleware\DispatchMiddleware;
use Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware;
use Zend\Expressive\Router\Middleware\RouteMiddleware;
use Zend\Expressive\Router\RouteCollector;
use Zend\HttpHandlerRunner\Emitter\EmitterInterface;
use Zend\HttpHandlerRunner\RequestHandlerRunner;
use Zend\ServiceManager\Factory\FactoryInterface;
use Zend\Stratigility\MiddlewarePipe;
use Mezzio\Application;
use Mezzio\Handler\NotFoundHandler;
use Mezzio\MiddlewareFactory;
use Mezzio\Router\Middleware\DispatchMiddleware;
use Mezzio\Router\Middleware\MethodNotAllowedMiddleware;
use Mezzio\Router\Middleware\RouteMiddleware;
use Mezzio\Router\RouteCollector;
use Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
use Laminas\HttpHandlerRunner\RequestHandlerRunner;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\Stratigility\MiddlewarePipe;
class Factory implements FactoryInterface
{

View File

@ -19,9 +19,9 @@ class Pet
* Add a new pet to the store
* @PHA\Post()
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/json")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/json")
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/xml")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/xml")
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\Pet::class,"objectAttr":"bodyData"})
* TODO check if producer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
@ -44,9 +44,9 @@ class Pet
* Update an existing pet
* @PHA\Put()
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/json")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/json")
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/xml")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/xml")
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\Pet::class,"objectAttr":"bodyData"})
* TODO check if producer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")

View File

@ -19,7 +19,7 @@ class StoreOrder
* Place an order for a pet
* @PHA\Post()
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/json")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/json")
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\Order::class,"objectAttr":"bodyData"})
* TODO check if producer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")

View File

@ -19,7 +19,7 @@ class User
* Create user
* @PHA\Post()
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/json")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/json")
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\User::class,"objectAttr":"bodyData"})
* @param ServerRequestInterface $request
*

View File

@ -19,7 +19,7 @@ class UserCreateWithArray
* Creates list of users with given input array
* @PHA\Post()
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/json")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/json")
* TODO check if attribute is valid and can handle your container type
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":"\App\DTO\User[]","objectAttr":"bodyData"})
* @param ServerRequestInterface $request

View File

@ -19,7 +19,7 @@ class UserCreateWithList
* Creates list of users with given input array
* @PHA\Post()
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/json")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/json")
* TODO check if attribute is valid and can handle your container type
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":"\App\DTO\User[]","objectAttr":"bodyData"})
* @param ServerRequestInterface $request

View File

@ -49,7 +49,7 @@ class UserUsername
* Updated user
* @PHA\Put()
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="application/json")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaRange="application/json")
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\User::class,"objectAttr":"bodyData"})
* @param ServerRequestInterface $request
*

View File

@ -7,7 +7,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Zend\Stdlib\ErrorHandler;
use Laminas\Stdlib\ErrorHandler;
class InternalServerError implements MiddlewareInterface
{

View File

@ -1,39 +0,0 @@
#Empty configuration placeholder, remove when you add any real configuration settings to this file
{}
#Enable configuration cache
#cache_configuration: true
#Articus\PathHandler\RouteInjection\Factory:
# #Enable routing table cache
# router:
# cache:
# adapter: filesystem
# options:
# cache_dir: data/cache/ZendCache
# namespace: ph-router
# plugins:
# serializer:
# serializer: phpserialize
# #Enable handler metadata cache
# metadata:
# cache:
# adapter: filesystem
# options:
# cache_dir: data/cache/ZendCache
# namespace: ph-metadata
# plugins:
# serializer:
# serializer: phpserialize
#Enable data transfer metadata cache for DTOs
#Articus\DataTransfer\Service:
# metadata_cache:
# adapter:
# name: filesystem
# options:
# cache_dir: data/cache/ZendCache
# namespace: dt
# plugins:
# serializer:
# serializer: phpserialize

View File

@ -1,23 +0,0 @@
dependencies:
invokables:
Zend\HttpHandlerRunner\Emitter\EmitterInterface: Zend\HttpHandlerRunner\Emitter\SapiStreamEmitter
factories:
Zend\Expressive\Application: App\Factory
Zend\Expressive\MiddlewareContainer: Zend\Expressive\Container\MiddlewareContainerFactory
Zend\Expressive\MiddlewareFactory: Zend\Expressive\Container\MiddlewareFactoryFactory
Zend\Expressive\Router\RouteCollector: Zend\Expressive\Router\RouteCollectorFactory
Zend\Expressive\Router\RouterInterface: Articus\PathHandler\RouteInjection\Factory
Psr\Http\Message\ServerRequestInterface: Zend\Expressive\Container\ServerRequestFactoryFactory
Psr\Http\Message\StreamInterface: Zend\Expressive\Container\StreamFactoryFactory
Psr\Http\Message\ResponseInterface: Zend\Expressive\Container\ResponseFactoryFactory
Zend\Expressive\Router\Middleware\RouteMiddleware: Zend\Expressive\Router\Middleware\RouteMiddlewareFactory
Zend\Expressive\Router\Middleware\DispatchMiddleware: Zend\Expressive\Router\Middleware\DispatchMiddlewareFactory
Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware: Zend\Expressive\Router\Middleware\MethodNotAllowedMiddlewareFactory
Zend\Expressive\Handler\NotFoundHandler: Zend\Expressive\Container\NotFoundHandlerFactory
App\Middleware\InternalServerError: Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory
Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory:
App\Middleware\InternalServerError:
- Psr\Http\Message\ResponseInterface

View File

@ -1,33 +0,0 @@
dependencies:
factories:
Articus\DataTransfer\Service: Articus\DataTransfer\ServiceFactory
Articus\DataTransfer\Service:
metadata_cache:
adapter:
name: blackhole
strategies:
invokables:
App\Strategy\Date: App\Strategy\Date
App\Strategy\DateTime: App\Strategy\DateTime
App\Strategy\QueryParameter: App\Strategy\QueryParameter
App\Strategy\QueryParameterArray: App\Strategy\QueryParameterArray
aliases:
Date: App\Strategy\Date
DateTime: App\Strategy\DateTime
QueryParameter: App\Strategy\QueryParameter
QueryParameterArray: App\Strategy\QueryParameterArray
validators:
invokables:
App\Validator\Type: App\Validator\Type
App\Validator\QueryParameterType: App\Validator\QueryParameterType
App\Validator\QueryParameterArrayType: App\Validator\QueryParameterArrayType
factories:
Articus\DataTransfer\Validator\Dictionary: Articus\DataTransfer\Validator\Factory
Articus\DataTransfer\Validator\Collection: Articus\DataTransfer\Validator\Factory
aliases:
Dictionary: Articus\DataTransfer\Validator\Dictionary
Collection: Articus\DataTransfer\Validator\Collection
Type: App\Validator\Type
QueryParameterType: App\Validator\QueryParameterType
QueryParameterArrayType: App\Validator\QueryParameterArrayType

View File

@ -1,73 +0,0 @@
Articus\PathHandler\RouteInjection\Factory:
paths:
'/v2':
- App\Handler\AnotherFakeDummy
- App\Handler\Fake
- App\Handler\FakeBodyWithFileSchema
- App\Handler\FakeBodyWithQueryParams
- App\Handler\FakeHealth
- App\Handler\FakeInlineAdditionalProperties
- App\Handler\FakeJsonFormData
- App\Handler\FakeOuterBoolean
- App\Handler\FakeOuterComposite
- App\Handler\FakeOuterNumber
- App\Handler\FakeOuterString
- App\Handler\FakePetIdUploadImageWithRequiredFile
- App\Handler\FakeClassnameTest
- App\Handler\Foo
- App\Handler\Pet
- App\Handler\PetFindByStatus
- App\Handler\PetFindByTags
- App\Handler\PetPetId
- App\Handler\PetPetIdUploadImage
- App\Handler\StoreInventory
- App\Handler\StoreOrder
- App\Handler\StoreOrderOrderId
- App\Handler\User
- App\Handler\UserCreateWithArray
- App\Handler\UserCreateWithList
- App\Handler\UserLogin
- App\Handler\UserLogout
- App\Handler\UserUsername
handlers:
abstract_factories:
- Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory
# consumers:
# factories:
# invokables:
# attributes:
# factories:
# invokables:
# producers:
# factories:
# invokables:
Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory:
App\Handler\AnotherFakeDummy: []
App\Handler\Fake: []
App\Handler\FakeBodyWithFileSchema: []
App\Handler\FakeBodyWithQueryParams: []
App\Handler\FakeHealth: []
App\Handler\FakeInlineAdditionalProperties: []
App\Handler\FakeJsonFormData: []
App\Handler\FakeOuterBoolean: []
App\Handler\FakeOuterComposite: []
App\Handler\FakeOuterNumber: []
App\Handler\FakeOuterString: []
App\Handler\FakePetIdUploadImageWithRequiredFile: []
App\Handler\FakeClassnameTest: []
App\Handler\Foo: []
App\Handler\Pet: []
App\Handler\PetFindByStatus: []
App\Handler\PetFindByTags: []
App\Handler\PetPetId: []
App\Handler\PetPetIdUploadImage: []
App\Handler\StoreInventory: []
App\Handler\StoreOrder: []
App\Handler\StoreOrderOrderId: []
App\Handler\User: []
App\Handler\UserCreateWithArray: []
App\Handler\UserCreateWithList: []
App\Handler\UserLogin: []
App\Handler\UserLogout: []
App\Handler\UserUsername: []

View File

@ -1,25 +0,0 @@
{
"name": "GIT_USER_ID/GIT_REPO_ID",
"description": "",
"license": "unlicense",
"version": "1.0.0",
"type": "project",
"require": {
"php": "^7.1",
"ext-yaml": "^2.0",
"zendframework/zend-expressive": "^3.2",
"zendframework/zend-diactoros": "^2.1",
"articus/path-handler": "^0.4",
"articus/data-transfer": "^0.2",
"doctrine/annotations": "^1.6",
"zendframework/zend-cache": "^2.8",
"zendframework/zend-serializer": "^2.9",
"zendframework/zend-config": "^3.2",
"nikic/fast-route": "^1.3"
},
"autoload": {
"psr-4": {
"": "src/"
}
}
}

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
chdir(dirname(__DIR__));
/** @var \Zend\ServiceManager\ServiceManager $container */
$container = require_once __DIR__.'/../application/container.php';
/** @var \Zend\Expressive\Application $app */
$app = $container->get(\Zend\Expressive\Application::class);
$app->run();

View File

@ -1,31 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class AdditionalPropertiesClass
{
/**
* @DTA\Data(field="map_property", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Type", "options":{"type":"string"}}
* }})
* @var map[string,string]
*/
public $map_property;
/**
* @DTA\Data(field="map_of_map_property", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="ObjectArray", options={"type":map[string,string]::class})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Dictionary", "options":{"type":map[string,string]::class}}
* }})
* @var map[string,map[string,string]]
*/
public $map_of_map_property;
}

View File

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class Animal
{
/**
* @DTA\Data(field="className")
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $class_name;
/**
* @DTA\Data(field="color", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $color;
}

View File

@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class ArrayOfArrayOfNumberOnly
{
/**
* @DTA\Data(field="ArrayArrayNumber", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="ObjectArray", options={"type":float[]::class})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Dictionary", "options":{"type":float[]::class}}
* }})
* @var float[][]
*/
public $array_array_number;
}

View File

@ -1,21 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class ArrayOfNumberOnly
{
/**
* @DTA\Data(field="ArrayNumber", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Type", "options":{"type":"float"}}
* }})
* @var float[]
*/
public $array_number;
}

View File

@ -1,41 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class ArrayTest
{
/**
* @DTA\Data(field="array_of_string", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Type", "options":{"type":"string"}}
* }})
* @var string[]
*/
public $array_of_string;
/**
* @DTA\Data(field="array_array_of_integer", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="ObjectArray", options={"type":int[]::class})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Dictionary", "options":{"type":int[]::class}}
* }})
* @var int[][]
*/
public $array_array_of_integer;
/**
* @DTA\Data(field="array_array_of_model", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="ObjectArray", options={"type":\App\DTO\ReadOnlyFirst[]::class})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Dictionary", "options":{"type":\App\DTO\ReadOnlyFirst[]::class}}
* }})
* @var \App\DTO\ReadOnlyFirst[][]
*/
public $array_array_of_model;
}

View File

@ -1,49 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class Capitalization
{
/**
* @DTA\Data(field="smallCamel", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $small_camel;
/**
* @DTA\Data(field="CapitalCamel", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $capital_camel;
/**
* @DTA\Data(field="small_Snake", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $small_snake;
/**
* @DTA\Data(field="Capital_Snake", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $capital_snake;
/**
* @DTA\Data(field="SCA_ETH_Flow_Points", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $sca_eth_flow_points;
/**
* Name of the pet
* @DTA\Data(field="ATT_NAME", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $att_name;
}

View File

@ -1,30 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class Cat
{
/**
* @DTA\Data(field="className")
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $class_name;
/**
* @DTA\Data(field="color", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $color;
/**
* @DTA\Data(field="declawed", nullable=true)
* @DTA\Validator(name="Type", options={"type":"bool"})
* @var bool
*/
public $declawed;
}

View File

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class Category
{
/**
* @DTA\Data(field="id", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
*/
public $id;
/**
* @DTA\Data(field="name")
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $name;
}

View File

@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
* Model for testing model with \&quot;_class\&quot; property
*/
class ClassModel
{
/**
* @DTA\Data(field="_class", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $_class;
}

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class Client
{
/**
* @DTA\Data(field="client", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $client;
}

View File

@ -1,30 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class Dog
{
/**
* @DTA\Data(field="className")
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $class_name;
/**
* @DTA\Data(field="color", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $color;
/**
* @DTA\Data(field="breed", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $breed;
}

View File

@ -1,27 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class EnumArrays
{
/**
* @DTA\Data(field="just_symbol", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $just_symbol;
/**
* @DTA\Data(field="array_enum", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Type", "options":{"type":"string"}}
* }})
* @var string[]
*/
public $array_enum;
}

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class EnumClass
{
}

View File

@ -1,64 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class EnumTest
{
/**
* @DTA\Data(field="enum_string", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $enum_string;
/**
* @DTA\Data(field="enum_string_required")
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $enum_string_required;
/**
* @DTA\Data(field="enum_integer", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
*/
public $enum_integer;
/**
* @DTA\Data(field="enum_number", nullable=true)
* @DTA\Validator(name="Type", options={"type":"float"})
* @var float
*/
public $enum_number;
/**
* @DTA\Data(field="outerEnum", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\OuterEnum::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\OuterEnum::class})
* @var \App\DTO\OuterEnum
*/
public $outer_enum;
/**
* @DTA\Data(field="outerEnumInteger", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\OuterEnumInteger::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\OuterEnumInteger::class})
* @var \App\DTO\OuterEnumInteger
*/
public $outer_enum_integer;
/**
* @DTA\Data(field="outerEnumDefaultValue", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\OuterEnumDefaultValue::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\OuterEnumDefaultValue::class})
* @var \App\DTO\OuterEnumDefaultValue
*/
public $outer_enum_default_value;
/**
* @DTA\Data(field="outerEnumIntegerDefaultValue", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\OuterEnumIntegerDefaultValue::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\OuterEnumIntegerDefaultValue::class})
* @var \App\DTO\OuterEnumIntegerDefaultValue
*/
public $outer_enum_integer_default_value;
}

View File

@ -1,29 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class FileSchemaTestClass
{
/**
* @DTA\Data(field="file", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\File::class})
* @DTA\Validator(name="Dictionary", options={"type":\App\DTO\File::class})
* @var \App\DTO\File
*/
public $file;
/**
* @DTA\Data(field="files", nullable=true)
* TODO check validator and strategy are correct and can handle container item type
* @DTA\Strategy(name="ObjectArray", options={"type":\App\DTO\File::class})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Dictionary", "options":{"type":\App\DTO\File::class}}
* }})
* @var \App\DTO\File[]
*/
public $files;
}

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class Foo
{
/**
* @DTA\Data(field="bar", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $bar;
}

View File

@ -1,121 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DTO;
use Articus\DataTransfer\Annotation as DTA;
/**
*/
class FormatTest
{
/**
* @DTA\Data(field="integer", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @DTA\Validator(name="GreaterThan", options={"min":10, "inclusive":true})
* @DTA\Validator(name="LessThan", options={"max":100, "inclusive":true})
* @var int
*/
public $integer;
/**
* @DTA\Data(field="int32", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @DTA\Validator(name="GreaterThan", options={"min":20, "inclusive":true})
* @DTA\Validator(name="LessThan", options={"max":200, "inclusive":true})
* @var int
*/
public $int32;
/**
* @DTA\Data(field="int64", nullable=true)
* @DTA\Validator(name="Type", options={"type":"int"})
* @var int
*/
public $int64;
/**
* @DTA\Data(field="number")
* @DTA\Validator(name="Type", options={"type":"float"})
* @DTA\Validator(name="GreaterThan", options={"min":32.1, "inclusive":true})
* @DTA\Validator(name="LessThan", options={"max":543.2, "inclusive":true})
* @var float
*/
public $number;
/**
* @DTA\Data(field="float", nullable=true)
* @DTA\Validator(name="Type", options={"type":"float"})
* @DTA\Validator(name="GreaterThan", options={"min":54.3, "inclusive":true})
* @DTA\Validator(name="LessThan", options={"max":987.6, "inclusive":true})
* @var float
*/
public $float;
/**
* @DTA\Data(field="double", nullable=true)
* @DTA\Validator(name="Type", options={"type":"float"})
* @DTA\Validator(name="GreaterThan", options={"min":67.8, "inclusive":true})
* @DTA\Validator(name="LessThan", options={"max":123.4, "inclusive":true})
* @var float
*/
public $double;
/**
* @DTA\Data(field="string", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @DTA\Validator(name="Regex", options={"pattern":"/[a-z]/i"})
* @var string
*/
public $string;
/**
* @DTA\Data(field="byte")
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $byte;
/**
* @DTA\Data(field="binary", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\SplFileObject::class})
* @DTA\Validator(name="Dictionary", options={"type":\SplFileObject::class})
* @var \SplFileObject
*/
public $binary;
/**
* @DTA\Data(field="date")
* @DTA\Strategy(name="Date")
* @DTA\Validator(name="Date")
* @var \DateTime
*/
public $date;
/**
* @DTA\Data(field="dateTime", nullable=true)
* @DTA\Strategy(name="DateTime")
* @DTA\Validator(name="Date", options={"format": \DateTime::RFC3339})
* @var \DateTime
*/
public $date_time;
/**
* @DTA\Data(field="uuid", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @var string
*/
public $uuid;
/**
* @DTA\Data(field="password")
* @DTA\Validator(name="Type", options={"type":"string"})
* @DTA\Validator(name="StringLength", options={"min":10, "max":64})
* @var string
*/
public $password;
/**
* A string that is a 10 digit number. Can have leading zeros.
* @DTA\Data(field="pattern_with_digits", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @DTA\Validator(name="Regex", options={"pattern":"/^\\d{10}$/"})
* @var string
*/
public $pattern_with_digits;
/**
* A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01.
* @DTA\Data(field="pattern_with_digits_and_delimiter", nullable=true)
* @DTA\Validator(name="Type", options={"type":"string"})
* @DTA\Validator(name="Regex", options={"pattern":"/^image_\\d{1,3}$/i"})
* @var string
*/
public $pattern_with_digits_and_delimiter;
}

Some files were not shown because too many files have changed in this diff Show More