[PHP][Symfony] Enhancements (#6615)

* Removed commented code

* Input validation is now supported as strict JSON validation

* [PHP][Symfony] Improve the implementation
Closes #6614

* Generated code is tested to assure it compiles and updated README to dynamically load dependencies via composer

* Updated shell script because shippable tests were failing
This commit is contained in:
naelrashdeen
2017-10-23 16:50:56 +02:00
committed by wing328
parent a63e3f14f5
commit b034e4446a
84 changed files with 8575 additions and 956 deletions

View File

@@ -0,0 +1,70 @@
<?php
/**
* SwaggerServerApiPass
*
* PHP version 5
*
* @category Class
* @package Swagger\Server\DependencyInjection\Compiler
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore
*
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace Swagger\Server\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* SwaggerServerApiPass Class Doc Comment
*
* @category Class
* @package Swagger\Server\DependencyInjection\Compiler
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class SwaggerServerApiPass implements CompilerPassInterface
{
/**
* You can modify the container here before it is dumped to PHP code.
*
* @param ContainerBuilder $container
*/
public function process(ContainerBuilder $container) {
// always first check if the primary service is defined
if (!$container->has('swagger_server.api.api_server')) {
return;
}
$definition = $container->findDefinition('swagger_server.api.api_server');
// find all service IDs with the swagger_server.api tag
$taggedServices = $container->findTaggedServiceIds('swagger_server.api');
foreach ($taggedServices as $id => $tags) {
foreach ($tags as $tag) {
// add the transport service to the ChainTransport service
$definition->addMethodCall('addApiHandler', [$tag['api'], new Reference($id)]);
}
}
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* SwaggerServerExtension
*
* PHP version 5
*
* @category Class
* @package Swagger\Server\DependencyInjection
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore
*
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace Swagger\Server\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
/**
* SwaggerServerExtension Class Doc Comment
*
* @category Class
* @package Swagger\Server\DependencyInjection
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class SwaggerServerExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
public function getAlias()
{
return 'swagger_server';
}
}