forked from loafle/openapi-generator-original
Zend Expressive fix and upgrade to version 2 (#6461)
* upgraded zend-expressive from version 1 to 2 * Changed error handler for compatibility with Zend Expressive 2 * generated newest sample files for Petstore ze-ph * removed ErrorMiddleware because it is never been used anymore. Regenerated samples * removed ErrorMiddleware Template from Codegen * remove ErrorMiddleware from petstore sample * Fixed some code styles * regenerated ze-ph samples with corrected code styles * added new line at the end of the file
This commit is contained in:
parent
ccc980e619
commit
c5c639b62b
@ -55,7 +55,6 @@ public class ZendExpressivePathHandlerServerCodegen extends AbstractPhpCodegen {
|
||||
supportingFiles.add(new SupportingFile("Date.php.mustache", packagePath + File.separator + srcBasePath + File.separator + "Strategy", "Date.php"));
|
||||
supportingFiles.add(new SupportingFile("DateTime.php.mustache", packagePath + File.separator + srcBasePath + File.separator + "Strategy", "DateTime.php"));
|
||||
supportingFiles.add(new SupportingFile("Type.php.mustache", packagePath + File.separator + srcBasePath + File.separator + "Validator", "Type.php"));
|
||||
supportingFiles.add(new SupportingFile("ErrorMiddleware.php.mustache", packagePath + File.separator + srcBasePath, "ErrorMiddleware.php"));
|
||||
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, "1.0.0");
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ class Date extends DateTime
|
||||
*/
|
||||
protected function parseDateString($arrayValue)
|
||||
{
|
||||
return \DateTime::createFromFormat(static::DATE_TIME_FORMAT.' H:i:sP', $arrayValue.' 00:00:00+00:00', new \DateTimeZone('UTC'));
|
||||
return \DateTime::createFromFormat(
|
||||
static::DATE_TIME_FORMAT . ' H:i:sP',
|
||||
$arrayValue . ' 00:00:00+00:00',
|
||||
new \DateTimeZone('UTC')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace {{invokerPackage}}\Strategy;
|
||||
|
||||
use Articus\DataTransfer\Strategy\StrategyInterface;
|
||||
|
||||
class DateTime implements StrategyInterface
|
||||
{
|
||||
const DATE_TIME_FORMAT = \DateTime::RFC3339;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
namespace {{invokerPackage}};
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Stratigility\ErrorMiddlewareInterface;
|
||||
|
||||
class ErrorMiddleware implements ErrorMiddlewareInterface
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function __invoke($error, Request $request, Response $response, callable $out = null)
|
||||
{
|
||||
$response = $response->withStatus(500, 'Internal server error');
|
||||
$response->getBody()->write((string)$error);
|
||||
error_log((string) $error);
|
||||
return ($out === null)? $response : $out($request, $response);
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@ use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
{{#operations}}
|
||||
|
||||
{{#description}}
|
||||
/**
|
||||
* {{&description}}
|
||||
@ -40,7 +39,11 @@ class {{classname}} implements {{interfacesToImplement}}
|
||||
* 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="{{mediaType}}")
|
||||
{{/produces}}
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
{{#returnType}}
|
||||
*
|
||||
* @return {{returnType}}
|
||||
{{/returnType}}
|
||||
*/
|
||||
|
@ -3,17 +3,24 @@ dependencies:
|
||||
#Has to add this line because currently router is strict requirement for Zend\Expressive\Application even if only middleware_pipeline is used
|
||||
Zend\Expressive\Router\RouterInterface: Zend\Expressive\Router\ZendRouter
|
||||
Zend\Diactoros\Response\EmitterInterface: Zend\Diactoros\Response\SapiStreamEmitter
|
||||
{{invokerPackage}}\ErrorMiddleware: {{invokerPackage}}\ErrorMiddleware
|
||||
factories:
|
||||
Zend\Expressive\Application: Zend\Expressive\Container\ApplicationFactory
|
||||
Articus\PathHandler\Middleware: Articus\PathHandler\MiddlewareFactory
|
||||
Articus\DataTransfer\Service: Articus\DataTransfer\ServiceFactory
|
||||
Zend\Stratigility\Middleware\ErrorHandler: Zend\Expressive\Container\ErrorHandlerFactory
|
||||
Zend\Expressive\Middleware\ErrorResponseGenerator: Zend\Expressive\Container\WhoopsErrorResponseGeneratorFactory
|
||||
Zend\Expressive\Whoops: Zend\Expressive\Container\WhoopsFactory
|
||||
Zend\Expressive\WhoopsPageHandler: Zend\Expressive\Container\WhoopsPageHandlerFactory
|
||||
|
||||
middleware_pipeline:
|
||||
error:
|
||||
middleware: Zend\Stratigility\Middleware\ErrorHandler
|
||||
api:
|
||||
middleware: Articus\PathHandler\Middleware
|
||||
path: {{basePathWithoutHost}}
|
||||
error:
|
||||
middleware: {{invokerPackage}}\ErrorMiddleware
|
||||
error: true
|
||||
priority: -10000
|
||||
|
||||
whoops:
|
||||
json_exceptions:
|
||||
display: true
|
||||
show_trace: true
|
||||
ajax_only: true
|
||||
|
@ -7,12 +7,14 @@
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"ext-yaml" : "^1.2 || ^2.0",
|
||||
"zendframework/zend-expressive": "^1.0",
|
||||
"zendframework/zend-expressive-router": "1.2.*",
|
||||
"articus/path-handler": "0.1.*",
|
||||
"zendframework/zend-expressive": "^2.0",
|
||||
"zendframework/zend-expressive-router": "^2.1",
|
||||
"zendframework/zend-expressive-zendrouter": "^2.0",
|
||||
"articus/path-handler": "0.2.*",
|
||||
"articus/data-transfer": "*",
|
||||
"zendframework/zend-serializer": "*",
|
||||
"zendframework/zend-config": "*"
|
||||
"zendframework/zend-config": "*",
|
||||
"filp/whoops": "^2.1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -1,2 +1,3 @@
|
||||
#App
|
||||
cache_configuration: false
|
||||
debug: true
|
||||
|
@ -127,5 +127,4 @@ class {{classname}}
|
||||
*/
|
||||
public ${{name}};
|
||||
{{/vars}}
|
||||
}
|
||||
{{/model}}{{/models}}
|
||||
}{{/model}}{{/models}}
|
||||
|
@ -1 +1 @@
|
||||
2.2.3-SNAPSHOT
|
||||
2.3.0-SNAPSHOT
|
@ -1,2 +1,3 @@
|
||||
#App
|
||||
cache_configuration: false
|
||||
debug: true
|
||||
|
@ -3,17 +3,24 @@ dependencies:
|
||||
#Has to add this line because currently router is strict requirement for Zend\Expressive\Application even if only middleware_pipeline is used
|
||||
Zend\Expressive\Router\RouterInterface: Zend\Expressive\Router\ZendRouter
|
||||
Zend\Diactoros\Response\EmitterInterface: Zend\Diactoros\Response\SapiStreamEmitter
|
||||
App\ErrorMiddleware: App\ErrorMiddleware
|
||||
factories:
|
||||
Zend\Expressive\Application: Zend\Expressive\Container\ApplicationFactory
|
||||
Articus\PathHandler\Middleware: Articus\PathHandler\MiddlewareFactory
|
||||
Articus\DataTransfer\Service: Articus\DataTransfer\ServiceFactory
|
||||
Zend\Stratigility\Middleware\ErrorHandler: Zend\Expressive\Container\ErrorHandlerFactory
|
||||
Zend\Expressive\Middleware\ErrorResponseGenerator: Zend\Expressive\Container\WhoopsErrorResponseGeneratorFactory
|
||||
Zend\Expressive\Whoops: Zend\Expressive\Container\WhoopsFactory
|
||||
Zend\Expressive\WhoopsPageHandler: Zend\Expressive\Container\WhoopsPageHandlerFactory
|
||||
|
||||
middleware_pipeline:
|
||||
error:
|
||||
middleware: Zend\Stratigility\Middleware\ErrorHandler
|
||||
api:
|
||||
middleware: Articus\PathHandler\Middleware
|
||||
path: /v2
|
||||
error:
|
||||
middleware: App\ErrorMiddleware
|
||||
error: true
|
||||
priority: -10000
|
||||
|
||||
whoops:
|
||||
json_exceptions:
|
||||
display: true
|
||||
show_trace: true
|
||||
ajax_only: true
|
||||
|
@ -9,6 +9,12 @@ path_handler:
|
||||
handler: Fake
|
||||
may_terminate: true
|
||||
child_routes:
|
||||
'jsonFormData':
|
||||
type: Literal
|
||||
options:
|
||||
route: /jsonFormData
|
||||
defaults:
|
||||
handler: FakeJsonFormData
|
||||
'outer':
|
||||
type: Literal
|
||||
options:
|
||||
@ -38,6 +44,12 @@ path_handler:
|
||||
route: /string
|
||||
defaults:
|
||||
handler: FakeOuterString
|
||||
'fake_classname_test':
|
||||
type: Literal
|
||||
options:
|
||||
route: /fake_classname_test
|
||||
defaults:
|
||||
handler: FakeClassnameTest
|
||||
'pet':
|
||||
type: Literal
|
||||
options:
|
||||
@ -150,10 +162,12 @@ path_handler:
|
||||
handlers:
|
||||
invokables:
|
||||
Fake: App\Handler\Fake
|
||||
FakeJsonFormData: App\Handler\FakeJsonFormData
|
||||
FakeOuterBoolean: App\Handler\FakeOuterBoolean
|
||||
FakeOuterComposite: App\Handler\FakeOuterComposite
|
||||
FakeOuterNumber: App\Handler\FakeOuterNumber
|
||||
FakeOuterString: App\Handler\FakeOuterString
|
||||
FakeClassnameTest: App\Handler\FakeClassnameTest
|
||||
Pet: App\Handler\Pet
|
||||
PetFindByStatus: App\Handler\PetFindByStatus
|
||||
PetFindByTags: App\Handler\PetFindByTags
|
||||
|
@ -7,12 +7,14 @@
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"ext-yaml" : "^1.2 || ^2.0",
|
||||
"zendframework/zend-expressive": "^1.0",
|
||||
"zendframework/zend-expressive-router": "1.2.*",
|
||||
"articus/path-handler": "0.1.*",
|
||||
"zendframework/zend-expressive": "^2.0",
|
||||
"zendframework/zend-expressive-router": "^2.1",
|
||||
"zendframework/zend-expressive-zendrouter": "^2.0",
|
||||
"articus/path-handler": "0.2.*",
|
||||
"articus/data-transfer": "*",
|
||||
"zendframework/zend-serializer": "*",
|
||||
"zendframework/zend-config": "*"
|
||||
"zendframework/zend-config": "*",
|
||||
"filp/whoops": "^2.1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -21,4 +21,3 @@ class AdditionalPropertiesClass
|
||||
*/
|
||||
public $map_of_map_property;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,3 @@ class Animal
|
||||
*/
|
||||
public $color;
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,3 @@ use Articus\DataTransfer\Annotation as DTA;
|
||||
class AnimalFarm
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -27,4 +27,3 @@ class ApiResponse
|
||||
*/
|
||||
public $message;
|
||||
}
|
||||
|
||||
|
@ -18,4 +18,3 @@ class ArrayOfArrayOfNumberOnly
|
||||
*/
|
||||
public $array_array_number;
|
||||
}
|
||||
|
||||
|
@ -17,4 +17,3 @@ class ArrayOfNumberOnly
|
||||
*/
|
||||
public $array_number;
|
||||
}
|
||||
|
||||
|
@ -35,4 +35,3 @@ class ArrayTest
|
||||
*/
|
||||
public $array_array_of_model;
|
||||
}
|
||||
|
||||
|
@ -46,4 +46,3 @@ class Capitalization
|
||||
*/
|
||||
public $att_name;
|
||||
}
|
||||
|
||||
|
@ -27,4 +27,3 @@ class Cat
|
||||
*/
|
||||
public $declawed;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,3 @@ class Category
|
||||
*/
|
||||
public $name;
|
||||
}
|
||||
|
||||
|
@ -16,4 +16,3 @@ class ClassModel
|
||||
*/
|
||||
public $_class;
|
||||
}
|
||||
|
||||
|
@ -15,4 +15,3 @@ class Client
|
||||
*/
|
||||
public $client;
|
||||
}
|
||||
|
||||
|
@ -27,4 +27,3 @@ class Dog
|
||||
*/
|
||||
public $breed;
|
||||
}
|
||||
|
||||
|
@ -23,4 +23,3 @@ class EnumArrays
|
||||
*/
|
||||
public $array_enum;
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,3 @@ use Articus\DataTransfer\Annotation as DTA;
|
||||
class EnumClass
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -34,4 +34,3 @@ class EnumTest
|
||||
*/
|
||||
public $outer_enum;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,8 @@ class FormatTest
|
||||
public $string;
|
||||
/**
|
||||
* @DTA\Data(field="byte")
|
||||
* @DTA\Validator(name="Type", options={"type":"string"})
|
||||
* @DTA\Validator(name="Regex", options={"pattern":"/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/"})
|
||||
* @var string
|
||||
*/
|
||||
public $byte;
|
||||
@ -99,4 +101,3 @@ class FormatTest
|
||||
*/
|
||||
public $password;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,3 @@ class HasOnlyReadOnly
|
||||
*/
|
||||
public $foo;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,3 @@ class MapTest
|
||||
*/
|
||||
public $map_of_enum_string;
|
||||
}
|
||||
|
||||
|
@ -29,4 +29,3 @@ class MixedPropertiesAndAdditionalPropertiesClass
|
||||
*/
|
||||
public $map;
|
||||
}
|
||||
|
||||
|
@ -22,4 +22,3 @@ class Model200Response
|
||||
*/
|
||||
public $class;
|
||||
}
|
||||
|
||||
|
@ -16,4 +16,3 @@ class ModelReturn
|
||||
*/
|
||||
public $return;
|
||||
}
|
||||
|
||||
|
@ -34,4 +34,3 @@ class Name
|
||||
*/
|
||||
public $_123_number;
|
||||
}
|
||||
|
||||
|
@ -15,4 +15,3 @@ class NumberOnly
|
||||
*/
|
||||
public $just_number;
|
||||
}
|
||||
|
||||
|
@ -47,4 +47,3 @@ class Order
|
||||
*/
|
||||
public $complete;
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,3 @@ use Articus\DataTransfer\Annotation as DTA;
|
||||
class OuterBoolean
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -30,4 +30,3 @@ class OuterComposite
|
||||
*/
|
||||
public $my_boolean;
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,3 @@ use Articus\DataTransfer\Annotation as DTA;
|
||||
class OuterEnum
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,3 @@ use Articus\DataTransfer\Annotation as DTA;
|
||||
class OuterNumber
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,3 @@ use Articus\DataTransfer\Annotation as DTA;
|
||||
class OuterString
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -52,4 +52,3 @@ class Pet
|
||||
*/
|
||||
public $status;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,3 @@ class ReadOnlyFirst
|
||||
*/
|
||||
public $baz;
|
||||
}
|
||||
|
||||
|
@ -15,4 +15,3 @@ class SpecialModelName
|
||||
*/
|
||||
public $special_property_name;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,3 @@ class Tag
|
||||
*/
|
||||
public $name;
|
||||
}
|
||||
|
||||
|
@ -58,4 +58,3 @@ class User
|
||||
*/
|
||||
public $user_status;
|
||||
}
|
||||
|
||||
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Stratigility\ErrorMiddlewareInterface;
|
||||
|
||||
class ErrorMiddleware implements ErrorMiddlewareInterface
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function __invoke($error, Request $request, Response $response, callable $out = null)
|
||||
{
|
||||
$response = $response->withStatus(500, 'Internal server error');
|
||||
$response->getBody()->write((string)$error);
|
||||
error_log((string) $error);
|
||||
return ($out === null)? $response : $out($request, $response);
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class Fake implements Operation\PatchInterface, Operation\PostInterface, Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
@ -20,6 +19,10 @@ class Fake implements Operation\PatchInterface, Operation\PostInterface, Operati
|
||||
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\Client::class,"objectAttr":"body"})
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\Client
|
||||
*/
|
||||
public function handlePatch(ServerRequestInterface $request)
|
||||
@ -35,6 +38,9 @@ class Fake implements Operation\PatchInterface, Operation\PostInterface, Operati
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml; charset=utf-8")
|
||||
* 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/json; charset=utf-8")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
{
|
||||
@ -45,6 +51,9 @@ class Fake implements Operation\PatchInterface, Operation\PostInterface, Operati
|
||||
* To test enum parameters
|
||||
* 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="*/*")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Handler;
|
||||
|
||||
use Articus\PathHandler\Operation;
|
||||
use Articus\PathHandler\Annotation as PHA;
|
||||
use Articus\PathHandler\Consumer as PHConsumer;
|
||||
use Articus\PathHandler\Producer as PHProducer;
|
||||
use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
class FakeClassnameTest implements Operation\PatchInterface
|
||||
{
|
||||
/**
|
||||
* To test class name in snake case
|
||||
* 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\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\Client::class,"objectAttr":"body"})
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\Client
|
||||
*/
|
||||
public function handlePatch(ServerRequestInterface $request)
|
||||
{
|
||||
//TODO implement method
|
||||
/** @var \App\DTO\Client $body */
|
||||
$body = $request->getAttribute("body");
|
||||
throw new PHException\HttpCode(500, "Not implemented");
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Handler;
|
||||
|
||||
use Articus\PathHandler\Operation;
|
||||
use Articus\PathHandler\Annotation as PHA;
|
||||
use Articus\PathHandler\Consumer as PHConsumer;
|
||||
use Articus\PathHandler\Producer as PHProducer;
|
||||
use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
class FakeJsonFormData implements Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
* test json serialization of form data
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
{
|
||||
//TODO implement method
|
||||
throw new PHException\HttpCode(500, "Not implemented");
|
||||
}
|
||||
}
|
@ -10,11 +10,14 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class FakeOuterBoolean implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterBoolean::class,"objectAttr":"body"})
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\OuterBoolean
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
|
@ -10,11 +10,14 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class FakeOuterComposite implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterComposite::class,"objectAttr":"body"})
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\OuterComposite
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
|
@ -10,11 +10,14 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class FakeOuterNumber implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterNumber::class,"objectAttr":"body"})
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\OuterNumber
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
|
@ -10,11 +10,14 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class FakeOuterString implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":\App\DTO\OuterString::class,"objectAttr":"body"})
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\OuterString
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class Pet implements Operation\PostInterface, Operation\PutInterface
|
||||
{
|
||||
/**
|
||||
@ -24,6 +23,9 @@ class Pet implements Operation\PostInterface, Operation\PutInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
{
|
||||
@ -43,6 +45,9 @@ class Pet implements Operation\PostInterface, Operation\PutInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePut(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class PetFindByStatus implements Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
@ -19,6 +18,10 @@ class PetFindByStatus implements Operation\GetInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\Pet[]
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class PetFindByTags implements Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
@ -19,6 +18,10 @@ class PetFindByTags implements Operation\GetInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\Pet[]
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class PetPetId implements Operation\DeleteInterface, Operation\GetInterface, Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
@ -19,6 +18,9 @@ class PetPetId implements Operation\DeleteInterface, Operation\GetInterface, Ope
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handleDelete(ServerRequestInterface $request)
|
||||
{
|
||||
@ -31,6 +33,10 @@ class PetPetId implements Operation\DeleteInterface, Operation\GetInterface, Ope
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\Pet
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
@ -44,6 +50,9 @@ class PetPetId implements Operation\DeleteInterface, Operation\GetInterface, Ope
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -10,13 +10,16 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class PetPetIdUploadImage implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
* uploads an image
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\ApiResponse
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
|
@ -10,13 +10,16 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class StoreInventory implements Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return map[string,int]
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class StoreOrder implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
@ -20,6 +19,10 @@ class StoreOrder implements Operation\PostInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\Order
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class StoreOrderOrderId implements Operation\DeleteInterface, Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
@ -19,6 +18,9 @@ class StoreOrderOrderId implements Operation\DeleteInterface, Operation\GetInter
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handleDelete(ServerRequestInterface $request)
|
||||
{
|
||||
@ -31,6 +33,10 @@ class StoreOrderOrderId implements Operation\DeleteInterface, Operation\GetInter
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\Order
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class User implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
@ -20,6 +19,9 @@ class User implements Operation\PostInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class UserCreateWithArray implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
@ -20,6 +19,9 @@ class UserCreateWithArray implements Operation\PostInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class UserCreateWithList implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
@ -20,6 +19,9 @@ class UserCreateWithList implements Operation\PostInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class UserLogin implements Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
@ -19,6 +18,10 @@ class UserLogin implements Operation\GetInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class UserLogout implements Operation\GetInterface
|
||||
{
|
||||
/**
|
||||
@ -19,6 +18,9 @@ class UserLogout implements Operation\GetInterface
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
class UserUsername implements Operation\DeleteInterface, Operation\GetInterface, Operation\PutInterface
|
||||
{
|
||||
/**
|
||||
@ -19,6 +18,9 @@ class UserUsername implements Operation\DeleteInterface, Operation\GetInterface,
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handleDelete(ServerRequestInterface $request)
|
||||
{
|
||||
@ -31,6 +33,10 @@ class UserUsername implements Operation\DeleteInterface, Operation\GetInterface,
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\User
|
||||
*/
|
||||
public function handleGet(ServerRequestInterface $request)
|
||||
@ -45,6 +51,9 @@ class UserUsername implements Operation\DeleteInterface, Operation\GetInterface,
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/xml")
|
||||
* 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/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*/
|
||||
public function handlePut(ServerRequestInterface $request)
|
||||
{
|
||||
|
@ -12,6 +12,10 @@ class Date extends DateTime
|
||||
*/
|
||||
protected function parseDateString($arrayValue)
|
||||
{
|
||||
return \DateTime::createFromFormat(static::DATE_TIME_FORMAT.' H:i:sP', $arrayValue.' 00:00:00+00:00', new \DateTimeZone('UTC'));
|
||||
return \DateTime::createFromFormat(
|
||||
static::DATE_TIME_FORMAT . ' H:i:sP',
|
||||
$arrayValue . ' 00:00:00+00:00',
|
||||
new \DateTimeZone('UTC')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Strategy;
|
||||
|
||||
use Articus\DataTransfer\Strategy\StrategyInterface;
|
||||
|
||||
class DateTime implements StrategyInterface
|
||||
{
|
||||
const DATE_TIME_FORMAT = \DateTime::RFC3339;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user