[Slim] Improve codebase decouple (#438)

* [Slim] Decouple Api files into separated PHP Classes

This enhancement required for modular testing and code coverage generating.

* [Slim] Define all app routes in SlimRouter PHP Class. Generate new samples
This commit is contained in:
Yuriy Belenko
2018-07-06 02:37:14 -04:00
committed by William Cheng
parent 3408866b79
commit 9eeedede49
74 changed files with 2000 additions and 941 deletions

View File

@@ -48,13 +48,11 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen {
variableNamingConvention = "camelCase"; variableNamingConvention = "camelCase";
artifactVersion = "1.0.0"; artifactVersion = "1.0.0";
packagePath = ""; // empty packagePath (top folder) packagePath = ""; // empty packagePath (top folder)
invokerPackage = camelize("OpenAPIServer"); setInvokerPackage("OpenAPIServer");
modelPackage = packagePath + "\\Models"; apiPackage = invokerPackage + "\\" + apiDirName;
apiPackage = packagePath; modelPackage = invokerPackage + "\\" + modelDirName;
outputFolder = "generated-code" + File.separator + "slim"; outputFolder = "generated-code" + File.separator + "slim";
// no api files
apiTemplateFiles.clear();
// no test files // no test files
apiTestTemplateFiles.clear(); apiTestTemplateFiles.clear();
// no doc files // no doc files
@@ -63,11 +61,9 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen {
embeddedTemplateDir = templateDir = "php-slim-server"; embeddedTemplateDir = templateDir = "php-slim-server";
// additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
additionalProperties.put(CodegenConstants.GROUP_ID, groupId); additionalProperties.put(CodegenConstants.GROUP_ID, groupId);
additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId);
// additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
// override cliOptions from AbstractPhpCodegen // override cliOptions from AbstractPhpCodegen
for (CliOption co : cliOptions) { for (CliOption co : cliOptions) {
if (co.getOpt().equals(AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION)) { if (co.getOpt().equals(AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION)) {
@@ -76,12 +72,6 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen {
break; break;
} }
} }
supportingFiles.add(new SupportingFile("README.mustache", packagePath.replace('/', File.separatorChar), "README.md"));
supportingFiles.add(new SupportingFile("composer.json", packagePath.replace('/', File.separatorChar), "composer.json"));
supportingFiles.add(new SupportingFile("index.mustache", packagePath.replace('/', File.separatorChar), "index.php"));
supportingFiles.add(new SupportingFile(".htaccess", packagePath.replace('/', File.separatorChar), ".htaccess"));
supportingFiles.add(new SupportingFile(".gitignore", packagePath.replace('/', File.separatorChar), ".gitignore"));
} }
@Override @Override
@@ -99,6 +89,37 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen {
return "Generates a PHP Slim Framework server library."; return "Generates a PHP Slim Framework server library.";
} }
@Override
public String apiFileFolder() {
if (apiPackage.matches("^" + invokerPackage + "\\\\*(.+)")) {
// need to strip out invokerPackage from path
return (outputFolder + File.separator + toPackagePath(apiPackage.replaceFirst("^" + invokerPackage + "\\\\*(.+)", "$1"), srcBasePath));
}
return (outputFolder + File.separator + toPackagePath(apiPackage, srcBasePath));
}
@Override
public String modelFileFolder() {
if (modelPackage.matches("^" + invokerPackage + "\\\\*(.+)")) {
// need to strip out invokerPackage from path
return (outputFolder + File.separator + toPackagePath(modelPackage.replaceFirst("^" + invokerPackage + "\\\\*(.+)", "$1"), srcBasePath));
}
return (outputFolder + File.separator + toPackagePath(modelPackage, srcBasePath));
}
@Override
public void processOpts() {
super.processOpts();
supportingFiles.add(new SupportingFile("README.mustache", getPackagePath(), "README.md"));
supportingFiles.add(new SupportingFile("composer.mustache", getPackagePath(), "composer.json"));
supportingFiles.add(new SupportingFile("index.mustache", getPackagePath(), "index.php"));
supportingFiles.add(new SupportingFile(".htaccess", getPackagePath(), ".htaccess"));
supportingFiles.add(new SupportingFile(".gitignore", getPackagePath(), ".gitignore"));
supportingFiles.add(new SupportingFile("AbstractApiController.mustache", toSrcPath(invokerPackage, srcBasePath), "AbstractApiController.php"));
supportingFiles.add(new SupportingFile("SlimRouter.mustache", toSrcPath(invokerPackage, srcBasePath), "SlimRouter.php"));
}
@Override @Override
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) { public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
Map<String, Object> operations = (Map<String, Object>) objs.get("operations"); Map<String, Object> operations = (Map<String, Object>) objs.get("operations");

View File

@@ -0,0 +1,63 @@
<?php
/**
* Abstract Api Controller
*
* PHP version 5
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
{{#appName}}
* {{{appName}}}
*
{{/appName}}
{{#appDescription}}
* {{{appDescription}}}
{{/appDescription}}
{{#version}}
* OpenAPI spec version: {{{version}}}
{{/version}}
{{#infoEmail}}
* Contact: {{{infoEmail}}}
{{/infoEmail}}
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace {{invokerPackage}};
/**
* ApiServer Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
abstract class AbstractApiController {
/**
* @var \Interop\Container\ContainerInterface Slim app container instance
*/
protected $container;
/**
* Route Controller constructor receives container
*
* @param \Interop\Container\ContainerInterface $container Slim app container instance
*/
public function __construct($container) {
$this->container = $container;
}
}

View File

@@ -0,0 +1,88 @@
<?php
/**
* SlimRouter
*
* PHP version 5
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**{{#apiInfo}}{{#appName}}
* {{{appName}}}
*
{{/appName}}
{{#appDescription}}
* {{{appDescription}}}
{{/appDescription}}
{{#version}}
* OpenAPI spec version: {{{version}}}
{{/version}}
{{#infoEmail}}
* Contact: {{{infoEmail}}}
{{/infoEmail}}
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace {{invokerPackage}};
{{#apis}}
use {{apiPackage}}\{{classname}};
{{/apis}}
use Slim\App;
use Psr\Container\ContainerInterface;
use InvalidArgumentException;
/**
* SlimRouter Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package {{apiPackage}}
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class SlimRouter {
/**
* @var $slimApp Slim\App instance
*/
private $slimApp;
/**
* Class constructor
*
* @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings
* @throws InvalidArgumentException when no container is provided that implements ContainerInterface
*/
public function __construct($container = []) {
$app = new App($container);
{{#apis}}
{{#operations}}
{{#operation}}
$app->{{httpMethod}}('{{{basePathWithoutHost}}}{{{path}}}', {{classname}}::class . ':{{operationId}}');
{{/operation}}
{{/operations}}
{{/apis}}
$this->slimApp = $app;
}
/**
* Returns Slim Framework instance
* @return App
*/
public function getSlimApp() {
return $this->slimApp;
}
}
{{/apiInfo}}

View File

@@ -0,0 +1,102 @@
<?php
/**
* {{classname}}
*
* PHP version 5
*
* @category Class
* @package {{apiPackage}}
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
{{#appName}}
* {{{appName}}}
*
{{/appName}}
{{#appDescription}}
* {{{appDescription}}}
{{/appDescription}}
{{#version}}
* OpenAPI spec version: {{{version}}}
{{/version}}
{{#infoEmail}}
* Contact: {{{infoEmail}}}
{{/infoEmail}}
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace {{apiPackage}};
use {{invokerPackage}}\AbstractApiController;
/**
* {{classname}} Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package {{apiPackage}}
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class {{classname}} extends AbstractApiController {
{{#operations}}
{{#operation}}
/**
* {{httpMethod}} {{operationId}}
* Summary: {{summary}}
* Notes: {{notes}}
{{#hasProduces}}
* Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}]
{{/hasProduces}}
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function {{operationId}}($request, $response, $args) {
{{#hasHeaderParams}}
$headers = $request->getHeaders();
{{#headerParams}}
${{paramName}} = $request->hasHeader('{{baseName}}') ? $headers['{{baseName}}'] : null;
{{/headerParams}}
{{/hasHeaderParams}}
{{#hasPathParams}}
{{#pathParams}}
${{paramName}} = $args['{{baseName}}'];
{{/pathParams}}
{{/hasPathParams}}
{{#hasQueryParams}}
$queryParams = $request->getQueryParams();
{{#queryParams}}
${{paramName}} = $request->getQueryParam('{{baseName}}');
{{/queryParams}}
{{/hasQueryParams}}
{{#hasFormParams}}
{{#formParams}}
{{^isFile}}
${{paramName}} = $request->getParsedBodyParam('{{baseName}}');
{{/isFile}}
{{#isFile}}
${{paramName}} = (key_exists('{{baseName}}', $request->getUploadedFiles())) ? $request->getUploadedFiles()['{{baseName}}'] : null;
{{/isFile}}
{{/formParams}}
{{/hasFormParams}}
{{#hasBodyParam}}
$body = $request->getParsedBody();
{{/hasBodyParam}}
$response->write('How about implementing {{nickname}} as a {{httpMethod}} method ?');
return $response;
}
{{#hasMore}}{{/hasMore}}
{{/operation}}
{{/operations}}
}

View File

@@ -1,6 +0,0 @@
{
"minimum-stability": "RC",
"require": {
"slim/slim": "3.*"
}
}

View File

@@ -0,0 +1,9 @@
{
"minimum-stability": "RC",
"require": {
"slim/slim": "3.*"
},
"autoload": {
"psr-4": { "{{escapedInvokerPackage}}\\": "{{srcBasePath}}/" }
}
}

View File

@@ -6,52 +6,9 @@
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
$app = new Slim\App(); use {{invokerPackage}}\SlimRouter;
{{/apiInfo}}
{{#apis}}{{#operations}}{{#operation}}
/**
* {{httpMethod}} {{nickname}}
* Summary: {{summary}}
* Notes: {{notes}}
{{#hasProduces}}
* Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}]
{{/hasProduces}}
*/
$app->{{httpMethod}}('{{{basePathWithoutHost}}}{{{path}}}', function($request, $response, $args) {
{{#hasHeaderParams}}
$headers = $request->getHeaders();
{{#headerParams}}
${{paramName}} = $request->hasHeader('{{baseName}}') ? $headers['{{baseName}}'] : null;
{{/headerParams}}
{{/hasHeaderParams}}
{{#hasPathParams}}
{{#pathParams}}
${{paramName}} = $args['{{baseName}}'];
{{/pathParams}}
{{/hasPathParams}}
{{#hasQueryParams}}
$queryParams = $request->getQueryParams();
{{#queryParams}}
${{paramName}} = $request->getQueryParam('{{baseName}}');
{{/queryParams}}
{{/hasQueryParams}}
{{#hasFormParams}}
{{#formParams}}
{{^isFile}}
${{paramName}} = $request->getParsedBodyParam('{{baseName}}');
{{/isFile}}
{{#isFile}}
${{paramName}} = (key_exists('{{baseName}}', $request->getUploadedFiles())) ? $request->getUploadedFiles()['{{baseName}}'] : null;
{{/isFile}}
{{/formParams}}
{{/hasFormParams}}
{{#hasBodyParam}}
$body = $request->getParsedBody();
{{/hasBodyParam}}
$response->write('How about implementing {{nickname}} as a {{httpMethod}} method ?');
return $response;
});
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
$router = new SlimRouter();
$app = $router->getSlimApp();
$app->run(); $app->run();

View File

@@ -1,15 +1,18 @@
<?php <?php
{{#models}}{{#model}}/* {{#models}}{{#model}}/**
* {{classname}} * {{classname}}
*/ */
namespace {{package}}; namespace {{modelPackage}};
/* /**
* {{classname}} * {{classname}}
*/ */
class {{classname}} { class {{classname}} {
{{#vars}}/* @var {{dataType}} ${{name}} {{#description}}{{description}}{{/description}} */
{{#vars}}
/** @var {{dataType}} ${{name}} {{#description}}{{description}}{{/description}}*/
private ${{name}}; private ${{name}};
{{/vars}} {{/vars}}
} }
{{/model}}{{/models}} {{/model}}{{/models}}

View File

@@ -2,5 +2,8 @@
"minimum-stability": "RC", "minimum-stability": "RC",
"require": { "require": {
"slim/slim": "3.*" "slim/slim": "3.*"
},
"autoload": {
"psr-4": { "OpenAPIServer\\": "lib/" }
} }
} }

View File

@@ -6,20 +6,8 @@
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
$app = new Slim\App(); use OpenAPIServer\SlimRouter;
/**
* PUT testCodeInjectEndRnNR
* Summary: To test code injection &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* Notes:
*/
$app->PUT('/fake', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testCodeInjectEndRnNR as a PUT method ?');
return $response;
});
$router = new SlimRouter();
$app = $router->getSlimApp();
$app->run(); $app->run();

View File

@@ -0,0 +1,55 @@
<?php
/**
* Abstract Api Controller
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end --
* OpenAPI spec version: 1.0.0 ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer;
/**
* ApiServer Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
abstract class AbstractApiController {
/**
* @var \Interop\Container\ContainerInterface Slim app container instance
*/
protected $container;
/**
* Route Controller constructor receives container
*
* @param \Interop\Container\ContainerInterface $container Slim app container instance
*/
public function __construct($container) {
$this->container = $container;
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* FakeApi
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end --
* OpenAPI spec version: 1.0.0 ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer\Api;
use OpenAPIServer\AbstractApiController;
/**
* FakeApi Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class FakeApi extends AbstractApiController {
/**
* PUT testCodeInjectEndRnNR
* Summary: To test code injection &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testCodeInjectEndRnNR($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testCodeInjectEndRnNR as a PUT method ?');
return $response;
}
}

View File

@@ -0,0 +1,15 @@
<?php
/**
* ModelReturn
*/
namespace OpenAPIServer\Model;
/**
* ModelReturn
*/
class ModelReturn {
/** @var int $return property description &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*/
private $return;
}

View File

@@ -1,13 +0,0 @@
<?php
/*
* ModelReturn
*/
namespace \Models;
/*
* ModelReturn
*/
class ModelReturn {
/* @var int $return property description &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r */
private $return;
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* SlimRouter
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end --
* OpenAPI spec version: 1.0.0 ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer;
use OpenAPIServer\Api\FakeApi;
use Slim\App;
use Psr\Container\ContainerInterface;
use InvalidArgumentException;
/**
* SlimRouter Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class SlimRouter {
/**
* @var $slimApp Slim\App instance
*/
private $slimApp;
/**
* Class constructor
*
* @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings
* @throws InvalidArgumentException when no container is provided that implements ContainerInterface
*/
public function __construct($container = []) {
$app = new App($container);
$app->PUT('/fake', FakeApi::class . ':testCodeInjectEndRnNR');
$this->slimApp = $app;
}
/**
* Returns Slim Framework instance
* @return App
*/
public function getSlimApp() {
return $this->slimApp;
}
}

View File

@@ -2,5 +2,8 @@
"minimum-stability": "RC", "minimum-stability": "RC",
"require": { "require": {
"slim/slim": "3.*" "slim/slim": "3.*"
},
"autoload": {
"psr-4": { "OpenAPIServer\\": "lib/" }
} }
} }

View File

@@ -6,457 +6,8 @@
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
$app = new Slim\App(); use OpenAPIServer\SlimRouter;
/**
* PATCH testSpecialTags
* Summary: To test special tags
* Notes: To test special tags
* Output-Formats: [application/json]
*/
$app->PATCH('/v2/another-fake/dummy', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testSpecialTags as a PATCH method ?');
return $response;
});
/**
* POST fakeOuterBooleanSerialize
* Summary:
* Notes: Test serialization of outer boolean types
* Output-Formats: [*_/_*]
*/
$app->POST('/v2/fake/outer/boolean', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterBooleanSerialize as a POST method ?');
return $response;
});
/**
* POST fakeOuterCompositeSerialize
* Summary:
* Notes: Test serialization of object with outer number type
* Output-Formats: [*_/_*]
*/
$app->POST('/v2/fake/outer/composite', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterCompositeSerialize as a POST method ?');
return $response;
});
/**
* POST fakeOuterNumberSerialize
* Summary:
* Notes: Test serialization of outer number types
* Output-Formats: [*_/_*]
*/
$app->POST('/v2/fake/outer/number', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterNumberSerialize as a POST method ?');
return $response;
});
/**
* POST fakeOuterStringSerialize
* Summary:
* Notes: Test serialization of outer string types
* Output-Formats: [*_/_*]
*/
$app->POST('/v2/fake/outer/string', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterStringSerialize as a POST method ?');
return $response;
});
/**
* PUT testBodyWithQueryParams
* Summary:
* Notes:
*/
$app->PUT('/v2/fake/body-with-query-params', function($request, $response, $args) {
$queryParams = $request->getQueryParams();
$query = $request->getQueryParam('query');
$body = $request->getParsedBody();
$response->write('How about implementing testBodyWithQueryParams as a PUT method ?');
return $response;
});
/**
* PATCH testClientModel
* Summary: To test \&quot;client\&quot; model
* Notes: To test \&quot;client\&quot; model
* Output-Formats: [application/json]
*/
$app->PATCH('/v2/fake', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testClientModel as a PATCH method ?');
return $response;
});
/**
* POST testEndpointParameters
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*/
$app->POST('/v2/fake', function($request, $response, $args) {
$integer = $request->getParsedBodyParam('integer');
$int32 = $request->getParsedBodyParam('int32');
$int64 = $request->getParsedBodyParam('int64');
$number = $request->getParsedBodyParam('number');
$float = $request->getParsedBodyParam('float');
$double = $request->getParsedBodyParam('double');
$string = $request->getParsedBodyParam('string');
$patternWithoutDelimiter = $request->getParsedBodyParam('pattern_without_delimiter');
$byte = $request->getParsedBodyParam('byte');
$binary = (key_exists('binary', $request->getUploadedFiles())) ? $request->getUploadedFiles()['binary'] : null;
$date = $request->getParsedBodyParam('date');
$dateTime = $request->getParsedBodyParam('dateTime');
$password = $request->getParsedBodyParam('password');
$callback = $request->getParsedBodyParam('callback');
$response->write('How about implementing testEndpointParameters as a POST method ?');
return $response;
});
/**
* GET testEnumParameters
* Summary: To test enum parameters
* Notes: To test enum parameters
*/
$app->GET('/v2/fake', function($request, $response, $args) {
$headers = $request->getHeaders();
$enumHeaderStringArray = $request->hasHeader('enum_header_string_array') ? $headers['enum_header_string_array'] : null;
$enumHeaderString = $request->hasHeader('enum_header_string') ? $headers['enum_header_string'] : null;
$queryParams = $request->getQueryParams();
$enumQueryStringArray = $request->getQueryParam('enum_query_string_array');
$enumQueryString = $request->getQueryParam('enum_query_string');
$enumQueryInteger = $request->getQueryParam('enum_query_integer');
$enumQueryDouble = $request->getQueryParam('enum_query_double');
$enumFormStringArray = $request->getParsedBodyParam('enum_form_string_array');
$enumFormString = $request->getParsedBodyParam('enum_form_string');
$response->write('How about implementing testEnumParameters as a GET method ?');
return $response;
});
/**
* POST testInlineAdditionalProperties
* Summary: test inline additionalProperties
* Notes:
*/
$app->POST('/v2/fake/inline-additionalProperties', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testInlineAdditionalProperties as a POST method ?');
return $response;
});
/**
* GET testJsonFormData
* Summary: test json serialization of form data
* Notes:
*/
$app->GET('/v2/fake/jsonFormData', function($request, $response, $args) {
$param = $request->getParsedBodyParam('param');
$param2 = $request->getParsedBodyParam('param2');
$response->write('How about implementing testJsonFormData as a GET method ?');
return $response;
});
/**
* PATCH testClassname
* Summary: To test class name in snake case
* Notes: To test class name in snake case
* Output-Formats: [application/json]
*/
$app->PATCH('/v2/fake_classname_test', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testClassname as a PATCH method ?');
return $response;
});
/**
* POST addPet
* Summary: Add a new pet to the store
* Notes:
*/
$app->POST('/v2/pet', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing addPet as a POST method ?');
return $response;
});
/**
* GET findPetsByStatus
* Summary: Finds Pets by status
* Notes: Multiple status values can be provided with comma separated strings
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/v2/pet/findByStatus', function($request, $response, $args) {
$queryParams = $request->getQueryParams();
$status = $request->getQueryParam('status');
$response->write('How about implementing findPetsByStatus as a GET method ?');
return $response;
});
/**
* GET findPetsByTags
* Summary: Finds Pets by tags
* Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/v2/pet/findByTags', function($request, $response, $args) {
$queryParams = $request->getQueryParams();
$tags = $request->getQueryParam('tags');
$response->write('How about implementing findPetsByTags as a GET method ?');
return $response;
});
/**
* PUT updatePet
* Summary: Update an existing pet
* Notes:
*/
$app->PUT('/v2/pet', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing updatePet as a PUT method ?');
return $response;
});
/**
* DELETE deletePet
* Summary: Deletes a pet
* Notes:
*/
$app->DELETE('/v2/pet/{petId}', function($request, $response, $args) {
$headers = $request->getHeaders();
$apiKey = $request->hasHeader('api_key') ? $headers['api_key'] : null;
$petId = $args['petId'];
$response->write('How about implementing deletePet as a DELETE method ?');
return $response;
});
/**
* GET getPetById
* Summary: Find pet by ID
* Notes: Returns a single pet
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/v2/pet/{petId}', function($request, $response, $args) {
$petId = $args['petId'];
$response->write('How about implementing getPetById as a GET method ?');
return $response;
});
/**
* POST updatePetWithForm
* Summary: Updates a pet in the store with form data
* Notes:
*/
$app->POST('/v2/pet/{petId}', function($request, $response, $args) {
$petId = $args['petId'];
$name = $request->getParsedBodyParam('name');
$status = $request->getParsedBodyParam('status');
$response->write('How about implementing updatePetWithForm as a POST method ?');
return $response;
});
/**
* POST uploadFile
* Summary: uploads an image
* Notes:
* Output-Formats: [application/json]
*/
$app->POST('/v2/pet/{petId}/uploadImage', function($request, $response, $args) {
$petId = $args['petId'];
$additionalMetadata = $request->getParsedBodyParam('additionalMetadata');
$file = (key_exists('file', $request->getUploadedFiles())) ? $request->getUploadedFiles()['file'] : null;
$response->write('How about implementing uploadFile as a POST method ?');
return $response;
});
/**
* POST uploadFileWithRequiredFile
* Summary: uploads an image (required)
* Notes:
* Output-Formats: [application/json]
*/
$app->POST('/v2/fake/{petId}/uploadImageWithRequiredFile', function($request, $response, $args) {
$petId = $args['petId'];
$additionalMetadata = $request->getParsedBodyParam('additionalMetadata');
$file = (key_exists('file', $request->getUploadedFiles())) ? $request->getUploadedFiles()['file'] : null;
$response->write('How about implementing uploadFileWithRequiredFile as a POST method ?');
return $response;
});
/**
* GET getInventory
* Summary: Returns pet inventories by status
* Notes: Returns a map of status codes to quantities
* Output-Formats: [application/json]
*/
$app->GET('/v2/store/inventory', function($request, $response, $args) {
$response->write('How about implementing getInventory as a GET method ?');
return $response;
});
/**
* POST placeOrder
* Summary: Place an order for a pet
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->POST('/v2/store/order', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing placeOrder as a POST method ?');
return $response;
});
/**
* DELETE deleteOrder
* Summary: Delete purchase order by ID
* Notes: For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*/
$app->DELETE('/v2/store/order/{order_id}', function($request, $response, $args) {
$orderId = $args['order_id'];
$response->write('How about implementing deleteOrder as a DELETE method ?');
return $response;
});
/**
* GET getOrderById
* Summary: Find purchase order by ID
* Notes: For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/v2/store/order/{order_id}', function($request, $response, $args) {
$orderId = $args['order_id'];
$response->write('How about implementing getOrderById as a GET method ?');
return $response;
});
/**
* POST createUser
* Summary: Create user
* Notes: This can only be done by the logged in user.
*/
$app->POST('/v2/user', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing createUser as a POST method ?');
return $response;
});
/**
* POST createUsersWithArrayInput
* Summary: Creates list of users with given input array
* Notes:
*/
$app->POST('/v2/user/createWithArray', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing createUsersWithArrayInput as a POST method ?');
return $response;
});
/**
* POST createUsersWithListInput
* Summary: Creates list of users with given input array
* Notes:
*/
$app->POST('/v2/user/createWithList', function($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing createUsersWithListInput as a POST method ?');
return $response;
});
/**
* GET loginUser
* Summary: Logs user into the system
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/v2/user/login', function($request, $response, $args) {
$queryParams = $request->getQueryParams();
$username = $request->getQueryParam('username');
$password = $request->getQueryParam('password');
$response->write('How about implementing loginUser as a GET method ?');
return $response;
});
/**
* GET logoutUser
* Summary: Logs out current logged in user session
* Notes:
*/
$app->GET('/v2/user/logout', function($request, $response, $args) {
$response->write('How about implementing logoutUser as a GET method ?');
return $response;
});
/**
* DELETE deleteUser
* Summary: Delete user
* Notes: This can only be done by the logged in user.
*/
$app->DELETE('/v2/user/{username}', function($request, $response, $args) {
$username = $args['username'];
$response->write('How about implementing deleteUser as a DELETE method ?');
return $response;
});
/**
* GET getUserByName
* Summary: Get user by user name
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/v2/user/{username}', function($request, $response, $args) {
$username = $args['username'];
$response->write('How about implementing getUserByName as a GET method ?');
return $response;
});
/**
* PUT updateUser
* Summary: Updated user
* Notes: This can only be done by the logged in user.
*/
$app->PUT('/v2/user/{username}', function($request, $response, $args) {
$username = $args['username'];
$body = $request->getParsedBody();
$response->write('How about implementing updateUser as a PUT method ?');
return $response;
});
$router = new SlimRouter();
$app = $router->getSlimApp();
$app->run(); $app->run();

View File

@@ -0,0 +1,54 @@
<?php
/**
* Abstract Api Controller
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer;
/**
* ApiServer Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
abstract class AbstractApiController {
/**
* @var \Interop\Container\ContainerInterface Slim app container instance
*/
protected $container;
/**
* Route Controller constructor receives container
*
* @param \Interop\Container\ContainerInterface $container Slim app container instance
*/
public function __construct($container) {
$this->container = $container;
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* AnotherFakeApi
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer\Api;
use OpenAPIServer\AbstractApiController;
/**
* AnotherFakeApi Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class AnotherFakeApi extends AbstractApiController {
/**
* PATCH testSpecialTags
* Summary: To test special tags
* Notes: To test special tags
* Output-Formats: [application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testSpecialTags($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testSpecialTags as a PATCH method ?');
return $response;
}
}

View File

@@ -0,0 +1,222 @@
<?php
/**
* FakeApi
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer\Api;
use OpenAPIServer\AbstractApiController;
/**
* FakeApi Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class FakeApi extends AbstractApiController {
/**
* POST fakeOuterBooleanSerialize
* Summary:
* Notes: Test serialization of outer boolean types
* Output-Formats: [*_/_*]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function fakeOuterBooleanSerialize($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterBooleanSerialize as a POST method ?');
return $response;
}
/**
* POST fakeOuterCompositeSerialize
* Summary:
* Notes: Test serialization of object with outer number type
* Output-Formats: [*_/_*]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function fakeOuterCompositeSerialize($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterCompositeSerialize as a POST method ?');
return $response;
}
/**
* POST fakeOuterNumberSerialize
* Summary:
* Notes: Test serialization of outer number types
* Output-Formats: [*_/_*]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function fakeOuterNumberSerialize($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterNumberSerialize as a POST method ?');
return $response;
}
/**
* POST fakeOuterStringSerialize
* Summary:
* Notes: Test serialization of outer string types
* Output-Formats: [*_/_*]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function fakeOuterStringSerialize($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing fakeOuterStringSerialize as a POST method ?');
return $response;
}
/**
* PUT testBodyWithQueryParams
* Summary:
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testBodyWithQueryParams($request, $response, $args) {
$queryParams = $request->getQueryParams();
$query = $request->getQueryParam('query');
$body = $request->getParsedBody();
$response->write('How about implementing testBodyWithQueryParams as a PUT method ?');
return $response;
}
/**
* PATCH testClientModel
* Summary: To test \&quot;client\&quot; model
* Notes: To test \&quot;client\&quot; model
* Output-Formats: [application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testClientModel($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testClientModel as a PATCH method ?');
return $response;
}
/**
* POST testEndpointParameters
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testEndpointParameters($request, $response, $args) {
$integer = $request->getParsedBodyParam('integer');
$int32 = $request->getParsedBodyParam('int32');
$int64 = $request->getParsedBodyParam('int64');
$number = $request->getParsedBodyParam('number');
$float = $request->getParsedBodyParam('float');
$double = $request->getParsedBodyParam('double');
$string = $request->getParsedBodyParam('string');
$patternWithoutDelimiter = $request->getParsedBodyParam('pattern_without_delimiter');
$byte = $request->getParsedBodyParam('byte');
$binary = (key_exists('binary', $request->getUploadedFiles())) ? $request->getUploadedFiles()['binary'] : null;
$date = $request->getParsedBodyParam('date');
$dateTime = $request->getParsedBodyParam('dateTime');
$password = $request->getParsedBodyParam('password');
$callback = $request->getParsedBodyParam('callback');
$response->write('How about implementing testEndpointParameters as a POST method ?');
return $response;
}
/**
* GET testEnumParameters
* Summary: To test enum parameters
* Notes: To test enum parameters
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testEnumParameters($request, $response, $args) {
$headers = $request->getHeaders();
$enumHeaderStringArray = $request->hasHeader('enum_header_string_array') ? $headers['enum_header_string_array'] : null;
$enumHeaderString = $request->hasHeader('enum_header_string') ? $headers['enum_header_string'] : null;
$queryParams = $request->getQueryParams();
$enumQueryStringArray = $request->getQueryParam('enum_query_string_array');
$enumQueryString = $request->getQueryParam('enum_query_string');
$enumQueryInteger = $request->getQueryParam('enum_query_integer');
$enumQueryDouble = $request->getQueryParam('enum_query_double');
$enumFormStringArray = $request->getParsedBodyParam('enum_form_string_array');
$enumFormString = $request->getParsedBodyParam('enum_form_string');
$response->write('How about implementing testEnumParameters as a GET method ?');
return $response;
}
/**
* POST testInlineAdditionalProperties
* Summary: test inline additionalProperties
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testInlineAdditionalProperties($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testInlineAdditionalProperties as a POST method ?');
return $response;
}
/**
* GET testJsonFormData
* Summary: test json serialization of form data
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testJsonFormData($request, $response, $args) {
$param = $request->getParsedBodyParam('param');
$param2 = $request->getParsedBodyParam('param2');
$response->write('How about implementing testJsonFormData as a GET method ?');
return $response;
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* FakeClassnameTags123Api
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer\Api;
use OpenAPIServer\AbstractApiController;
/**
* FakeClassnameTags123Api Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class FakeClassnameTags123Api extends AbstractApiController {
/**
* PATCH testClassname
* Summary: To test class name in snake case
* Notes: To test class name in snake case
* Output-Formats: [application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function testClassname($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing testClassname as a PATCH method ?');
return $response;
}
}

View File

@@ -0,0 +1,192 @@
<?php
/**
* PetApi
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer\Api;
use OpenAPIServer\AbstractApiController;
/**
* PetApi Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class PetApi extends AbstractApiController {
/**
* POST addPet
* Summary: Add a new pet to the store
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function addPet($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing addPet as a POST method ?');
return $response;
}
/**
* DELETE deletePet
* Summary: Deletes a pet
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function deletePet($request, $response, $args) {
$headers = $request->getHeaders();
$apiKey = $request->hasHeader('api_key') ? $headers['api_key'] : null;
$petId = $args['petId'];
$response->write('How about implementing deletePet as a DELETE method ?');
return $response;
}
/**
* GET findPetsByStatus
* Summary: Finds Pets by status
* Notes: Multiple status values can be provided with comma separated strings
* Output-Formats: [application/xml, application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function findPetsByStatus($request, $response, $args) {
$queryParams = $request->getQueryParams();
$status = $request->getQueryParam('status');
$response->write('How about implementing findPetsByStatus as a GET method ?');
return $response;
}
/**
* GET findPetsByTags
* Summary: Finds Pets by tags
* Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* Output-Formats: [application/xml, application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function findPetsByTags($request, $response, $args) {
$queryParams = $request->getQueryParams();
$tags = $request->getQueryParam('tags');
$response->write('How about implementing findPetsByTags as a GET method ?');
return $response;
}
/**
* GET getPetById
* Summary: Find pet by ID
* Notes: Returns a single pet
* Output-Formats: [application/xml, application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function getPetById($request, $response, $args) {
$petId = $args['petId'];
$response->write('How about implementing getPetById as a GET method ?');
return $response;
}
/**
* PUT updatePet
* Summary: Update an existing pet
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function updatePet($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing updatePet as a PUT method ?');
return $response;
}
/**
* POST updatePetWithForm
* Summary: Updates a pet in the store with form data
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function updatePetWithForm($request, $response, $args) {
$petId = $args['petId'];
$name = $request->getParsedBodyParam('name');
$status = $request->getParsedBodyParam('status');
$response->write('How about implementing updatePetWithForm as a POST method ?');
return $response;
}
/**
* POST uploadFile
* Summary: uploads an image
* Notes:
* Output-Formats: [application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function uploadFile($request, $response, $args) {
$petId = $args['petId'];
$additionalMetadata = $request->getParsedBodyParam('additionalMetadata');
$file = (key_exists('file', $request->getUploadedFiles())) ? $request->getUploadedFiles()['file'] : null;
$response->write('How about implementing uploadFile as a POST method ?');
return $response;
}
/**
* POST uploadFileWithRequiredFile
* Summary: uploads an image (required)
* Notes:
* Output-Formats: [application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function uploadFileWithRequiredFile($request, $response, $args) {
$petId = $args['petId'];
$additionalMetadata = $request->getParsedBodyParam('additionalMetadata');
$file = (key_exists('file', $request->getUploadedFiles())) ? $request->getUploadedFiles()['file'] : null;
$response->write('How about implementing uploadFileWithRequiredFile as a POST method ?');
return $response;
}
}

View File

@@ -0,0 +1,104 @@
<?php
/**
* StoreApi
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer\Api;
use OpenAPIServer\AbstractApiController;
/**
* StoreApi Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class StoreApi extends AbstractApiController {
/**
* DELETE deleteOrder
* Summary: Delete purchase order by ID
* Notes: For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function deleteOrder($request, $response, $args) {
$orderId = $args['order_id'];
$response->write('How about implementing deleteOrder as a DELETE method ?');
return $response;
}
/**
* GET getInventory
* Summary: Returns pet inventories by status
* Notes: Returns a map of status codes to quantities
* Output-Formats: [application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function getInventory($request, $response, $args) {
$response->write('How about implementing getInventory as a GET method ?');
return $response;
}
/**
* GET getOrderById
* Summary: Find purchase order by ID
* Notes: For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* Output-Formats: [application/xml, application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function getOrderById($request, $response, $args) {
$orderId = $args['order_id'];
$response->write('How about implementing getOrderById as a GET method ?');
return $response;
}
/**
* POST placeOrder
* Summary: Place an order for a pet
* Notes:
* Output-Formats: [application/xml, application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function placeOrder($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing placeOrder as a POST method ?');
return $response;
}
}

View File

@@ -0,0 +1,166 @@
<?php
/**
* UserApi
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer\Api;
use OpenAPIServer\AbstractApiController;
/**
* UserApi Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class UserApi extends AbstractApiController {
/**
* POST createUser
* Summary: Create user
* Notes: This can only be done by the logged in user.
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function createUser($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing createUser as a POST method ?');
return $response;
}
/**
* POST createUsersWithArrayInput
* Summary: Creates list of users with given input array
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function createUsersWithArrayInput($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing createUsersWithArrayInput as a POST method ?');
return $response;
}
/**
* POST createUsersWithListInput
* Summary: Creates list of users with given input array
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function createUsersWithListInput($request, $response, $args) {
$body = $request->getParsedBody();
$response->write('How about implementing createUsersWithListInput as a POST method ?');
return $response;
}
/**
* DELETE deleteUser
* Summary: Delete user
* Notes: This can only be done by the logged in user.
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function deleteUser($request, $response, $args) {
$username = $args['username'];
$response->write('How about implementing deleteUser as a DELETE method ?');
return $response;
}
/**
* GET getUserByName
* Summary: Get user by user name
* Notes:
* Output-Formats: [application/xml, application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function getUserByName($request, $response, $args) {
$username = $args['username'];
$response->write('How about implementing getUserByName as a GET method ?');
return $response;
}
/**
* GET loginUser
* Summary: Logs user into the system
* Notes:
* Output-Formats: [application/xml, application/json]
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function loginUser($request, $response, $args) {
$queryParams = $request->getQueryParams();
$username = $request->getQueryParam('username');
$password = $request->getQueryParam('password');
$response->write('How about implementing loginUser as a GET method ?');
return $response;
}
/**
* GET logoutUser
* Summary: Logs out current logged in user session
* Notes:
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function logoutUser($request, $response, $args) {
$response->write('How about implementing logoutUser as a GET method ?');
return $response;
}
/**
* PUT updateUser
* Summary: Updated user
* Notes: This can only be done by the logged in user.
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request
* @param \Psr\Http\Message\ResponseInterface $response Response
* @param array|null $args Path arguments
*/
public function updateUser($request, $response, $args) {
$username = $args['username'];
$body = $request->getParsedBody();
$response->write('How about implementing updateUser as a PUT method ?');
return $response;
}
}

View File

@@ -1,15 +1,18 @@
<?php <?php
/* /**
* AdditionalPropertiesClass * AdditionalPropertiesClass
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* AdditionalPropertiesClass * AdditionalPropertiesClass
*/ */
class AdditionalPropertiesClass { class AdditionalPropertiesClass {
/* @var map[string,string] $mapProperty */
/** @var map[string,string] $mapProperty */
private $mapProperty; private $mapProperty;
/* @var map[string,map[string,string]] $mapOfMapProperty */
/** @var map[string,map[string,string]] $mapOfMapProperty */
private $mapOfMapProperty; private $mapOfMapProperty;
} }

View File

@@ -0,0 +1,18 @@
<?php
/**
* Animal
*/
namespace OpenAPIServer\Model;
/**
* Animal
*/
class Animal {
/** @var string $className */
private $className;
/** @var string $color */
private $color;
}

View File

@@ -1,11 +1,12 @@
<?php <?php
/* /**
* AnimalFarm * AnimalFarm
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* AnimalFarm * AnimalFarm
*/ */
class AnimalFarm { class AnimalFarm {
}
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* ApiResponse
*/
namespace OpenAPIServer\Model;
/**
* ApiResponse
*/
class ApiResponse {
/** @var int $code */
private $code;
/** @var string $type */
private $type;
/** @var string $message */
private $message;
}

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* ArrayOfArrayOfNumberOnly * ArrayOfArrayOfNumberOnly
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* ArrayOfArrayOfNumberOnly * ArrayOfArrayOfNumberOnly
*/ */
class ArrayOfArrayOfNumberOnly { class ArrayOfArrayOfNumberOnly {
/* @var float[][] $arrayArrayNumber */
/** @var float[][] $arrayArrayNumber */
private $arrayArrayNumber; private $arrayArrayNumber;
} }

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* ArrayOfNumberOnly * ArrayOfNumberOnly
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* ArrayOfNumberOnly * ArrayOfNumberOnly
*/ */
class ArrayOfNumberOnly { class ArrayOfNumberOnly {
/* @var float[] $arrayNumber */
/** @var float[] $arrayNumber */
private $arrayNumber; private $arrayNumber;
} }

View File

@@ -0,0 +1,21 @@
<?php
/**
* ArrayTest
*/
namespace OpenAPIServer\Model;
/**
* ArrayTest
*/
class ArrayTest {
/** @var string[] $arrayOfString */
private $arrayOfString;
/** @var int[][] $arrayArrayOfInteger */
private $arrayArrayOfInteger;
/** @var \OpenAPIServer\Model\ReadOnlyFirst[][] $arrayArrayOfModel */
private $arrayArrayOfModel;
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Capitalization
*/
namespace OpenAPIServer\Model;
/**
* Capitalization
*/
class Capitalization {
/** @var string $smallCamel */
private $smallCamel;
/** @var string $capitalCamel */
private $capitalCamel;
/** @var string $smallSnake */
private $smallSnake;
/** @var string $capitalSnake */
private $capitalSnake;
/** @var string $sCAETHFlowPoints */
private $sCAETHFlowPoints;
/** @var string $aTTNAME Name of the pet */
private $aTTNAME;
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* Cat
*/
namespace OpenAPIServer\Model;
/**
* Cat
*/
class Cat {
/** @var string $className */
private $className;
/** @var string $color */
private $color;
/** @var bool $declawed */
private $declawed;
}

View File

@@ -0,0 +1,18 @@
<?php
/**
* Category
*/
namespace OpenAPIServer\Model;
/**
* Category
*/
class Category {
/** @var int $id */
private $id;
/** @var string $name */
private $name;
}

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* ClassModel * ClassModel
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* ClassModel * ClassModel
*/ */
class ClassModel { class ClassModel {
/* @var string $class */
/** @var string $class */
private $class; private $class;
} }

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* Client * Client
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* Client * Client
*/ */
class Client { class Client {
/* @var string $client */
/** @var string $client */
private $client; private $client;
} }

View File

@@ -0,0 +1,21 @@
<?php
/**
* Dog
*/
namespace OpenAPIServer\Model;
/**
* Dog
*/
class Dog {
/** @var string $className */
private $className;
/** @var string $color */
private $color;
/** @var string $breed */
private $breed;
}

View File

@@ -1,15 +1,18 @@
<?php <?php
/* /**
* EnumArrays * EnumArrays
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* EnumArrays * EnumArrays
*/ */
class EnumArrays { class EnumArrays {
/* @var string $justSymbol */
/** @var string $justSymbol */
private $justSymbol; private $justSymbol;
/* @var string[] $arrayEnum */
/** @var string[] $arrayEnum */
private $arrayEnum; private $arrayEnum;
} }

View File

@@ -1,11 +1,12 @@
<?php <?php
/* /**
* EnumClass * EnumClass
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* EnumClass * EnumClass
*/ */
class EnumClass { class EnumClass {
}
}

View File

@@ -0,0 +1,27 @@
<?php
/**
* EnumTest
*/
namespace OpenAPIServer\Model;
/**
* EnumTest
*/
class EnumTest {
/** @var string $enumString */
private $enumString;
/** @var string $enumStringRequired */
private $enumStringRequired;
/** @var int $enumInteger */
private $enumInteger;
/** @var double $enumNumber */
private $enumNumber;
/** @var \OpenAPIServer\Model\OuterEnum $outerEnum */
private $outerEnum;
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* FormatTest
*/
namespace OpenAPIServer\Model;
/**
* FormatTest
*/
class FormatTest {
/** @var int $integer */
private $integer;
/** @var int $int32 */
private $int32;
/** @var int $int64 */
private $int64;
/** @var float $number */
private $number;
/** @var float $float */
private $float;
/** @var double $double */
private $double;
/** @var string $string */
private $string;
/** @var string $byte */
private $byte;
/** @var \SplFileObject $binary */
private $binary;
/** @var \DateTime $date */
private $date;
/** @var \DateTime $dateTime */
private $dateTime;
/** @var string $uuid */
private $uuid;
/** @var string $password */
private $password;
}

View File

@@ -1,15 +1,18 @@
<?php <?php
/* /**
* HasOnlyReadOnly * HasOnlyReadOnly
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* HasOnlyReadOnly * HasOnlyReadOnly
*/ */
class HasOnlyReadOnly { class HasOnlyReadOnly {
/* @var string $bar */
/** @var string $bar */
private $bar; private $bar;
/* @var string $foo */
/** @var string $foo */
private $foo; private $foo;
} }

View File

@@ -0,0 +1,24 @@
<?php
/**
* MapTest
*/
namespace OpenAPIServer\Model;
/**
* MapTest
*/
class MapTest {
/** @var map[string,map[string,string]] $mapMapOfString */
private $mapMapOfString;
/** @var map[string,string] $mapOfEnumString */
private $mapOfEnumString;
/** @var map[string,bool] $directMap */
private $directMap;
/** @var \OpenAPIServer\Model\StringBooleanMap $indirectMap */
private $indirectMap;
}

View File

@@ -1,17 +1,21 @@
<?php <?php
/* /**
* MixedPropertiesAndAdditionalPropertiesClass * MixedPropertiesAndAdditionalPropertiesClass
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* MixedPropertiesAndAdditionalPropertiesClass * MixedPropertiesAndAdditionalPropertiesClass
*/ */
class MixedPropertiesAndAdditionalPropertiesClass { class MixedPropertiesAndAdditionalPropertiesClass {
/* @var string $uuid */
/** @var string $uuid */
private $uuid; private $uuid;
/* @var \DateTime $dateTime */
/** @var \DateTime $dateTime */
private $dateTime; private $dateTime;
/* @var map[string,\\Models\Animal] $map */
/** @var map[string,\OpenAPIServer\Model\Animal] $map */
private $map; private $map;
} }

View File

@@ -1,15 +1,18 @@
<?php <?php
/* /**
* Model200Response * Model200Response
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* Model200Response * Model200Response
*/ */
class Model200Response { class Model200Response {
/* @var int $name */
/** @var int $name */
private $name; private $name;
/* @var string $class */
/** @var string $class */
private $class; private $class;
} }

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* ModelList * ModelList
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* ModelList * ModelList
*/ */
class ModelList { class ModelList {
/* @var string $_123list */
/** @var string $_123list */
private $_123list; private $_123list;
} }

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* ModelReturn * ModelReturn
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* ModelReturn * ModelReturn
*/ */
class ModelReturn { class ModelReturn {
/* @var int $return */
/** @var int $return */
private $return; private $return;
} }

View File

@@ -0,0 +1,24 @@
<?php
/**
* Name
*/
namespace OpenAPIServer\Model;
/**
* Name
*/
class Name {
/** @var int $name */
private $name;
/** @var int $snakeCase */
private $snakeCase;
/** @var string $property */
private $property;
/** @var int $_123number */
private $_123number;
}

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* NumberOnly * NumberOnly
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* NumberOnly * NumberOnly
*/ */
class NumberOnly { class NumberOnly {
/* @var float $justNumber */
/** @var float $justNumber */
private $justNumber; private $justNumber;
} }

View File

@@ -0,0 +1,30 @@
<?php
/**
* Order
*/
namespace OpenAPIServer\Model;
/**
* Order
*/
class Order {
/** @var int $id */
private $id;
/** @var int $petId */
private $petId;
/** @var int $quantity */
private $quantity;
/** @var \DateTime $shipDate */
private $shipDate;
/** @var string $status Order Status*/
private $status;
/** @var bool $complete */
private $complete;
}

View File

@@ -1,17 +1,21 @@
<?php <?php
/* /**
* OuterComposite * OuterComposite
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* OuterComposite * OuterComposite
*/ */
class OuterComposite { class OuterComposite {
/* @var float $myNumber */
/** @var float $myNumber */
private $myNumber; private $myNumber;
/* @var string $myString */
/** @var string $myString */
private $myString; private $myString;
/* @var bool $myBoolean */
/** @var bool $myBoolean */
private $myBoolean; private $myBoolean;
} }

View File

@@ -1,11 +1,12 @@
<?php <?php
/* /**
* OuterEnum * OuterEnum
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* OuterEnum * OuterEnum
*/ */
class OuterEnum { class OuterEnum {
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Pet
*/
namespace OpenAPIServer\Model;
/**
* Pet
*/
class Pet {
/** @var int $id */
private $id;
/** @var \OpenAPIServer\Model\Category $category */
private $category;
/** @var string $name */
private $name;
/** @var string[] $photoUrls */
private $photoUrls;
/** @var \OpenAPIServer\Model\Tag[] $tags */
private $tags;
/** @var string $status pet status in the store*/
private $status;
}

View File

@@ -1,15 +1,18 @@
<?php <?php
/* /**
* ReadOnlyFirst * ReadOnlyFirst
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* ReadOnlyFirst * ReadOnlyFirst
*/ */
class ReadOnlyFirst { class ReadOnlyFirst {
/* @var string $bar */
/** @var string $bar */
private $bar; private $bar;
/* @var string $baz */
/** @var string $baz */
private $baz; private $baz;
} }

View File

@@ -1,13 +1,15 @@
<?php <?php
/* /**
* SpecialModelName * SpecialModelName
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* SpecialModelName * SpecialModelName
*/ */
class SpecialModelName { class SpecialModelName {
/* @var int $specialPropertyName */
/** @var int $specialPropertyName */
private $specialPropertyName; private $specialPropertyName;
} }

View File

@@ -1,11 +1,12 @@
<?php <?php
/* /**
* StringBooleanMap * StringBooleanMap
*/ */
namespace \Models; namespace OpenAPIServer\Model;
/* /**
* StringBooleanMap * StringBooleanMap
*/ */
class StringBooleanMap { class StringBooleanMap {
}
}

View File

@@ -0,0 +1,18 @@
<?php
/**
* Tag
*/
namespace OpenAPIServer\Model;
/**
* Tag
*/
class Tag {
/** @var int $id */
private $id;
/** @var string $name */
private $name;
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* User
*/
namespace OpenAPIServer\Model;
/**
* User
*/
class User {
/** @var int $id */
private $id;
/** @var string $username */
private $username;
/** @var string $firstName */
private $firstName;
/** @var string $lastName */
private $lastName;
/** @var string $email */
private $email;
/** @var string $password */
private $password;
/** @var string $phone */
private $phone;
/** @var int $userStatus User Status*/
private $userStatus;
}

View File

@@ -1,15 +0,0 @@
<?php
/*
* Animal
*/
namespace \Models;
/*
* Animal
*/
class Animal {
/* @var string $className */
private $className;
/* @var string $color */
private $color;
}

View File

@@ -1,17 +0,0 @@
<?php
/*
* ApiResponse
*/
namespace \Models;
/*
* ApiResponse
*/
class ApiResponse {
/* @var int $code */
private $code;
/* @var string $type */
private $type;
/* @var string $message */
private $message;
}

View File

@@ -1,17 +0,0 @@
<?php
/*
* ArrayTest
*/
namespace \Models;
/*
* ArrayTest
*/
class ArrayTest {
/* @var string[] $arrayOfString */
private $arrayOfString;
/* @var int[][] $arrayArrayOfInteger */
private $arrayArrayOfInteger;
/* @var \\Models\ReadOnlyFirst[][] $arrayArrayOfModel */
private $arrayArrayOfModel;
}

View File

@@ -1,23 +0,0 @@
<?php
/*
* Capitalization
*/
namespace \Models;
/*
* Capitalization
*/
class Capitalization {
/* @var string $smallCamel */
private $smallCamel;
/* @var string $capitalCamel */
private $capitalCamel;
/* @var string $smallSnake */
private $smallSnake;
/* @var string $capitalSnake */
private $capitalSnake;
/* @var string $sCAETHFlowPoints */
private $sCAETHFlowPoints;
/* @var string $aTTNAME Name of the pet */
private $aTTNAME;
}

View File

@@ -1,17 +0,0 @@
<?php
/*
* Cat
*/
namespace \Models;
/*
* Cat
*/
class Cat {
/* @var string $className */
private $className;
/* @var string $color */
private $color;
/* @var bool $declawed */
private $declawed;
}

View File

@@ -1,15 +0,0 @@
<?php
/*
* Category
*/
namespace \Models;
/*
* Category
*/
class Category {
/* @var int $id */
private $id;
/* @var string $name */
private $name;
}

View File

@@ -1,17 +0,0 @@
<?php
/*
* Dog
*/
namespace \Models;
/*
* Dog
*/
class Dog {
/* @var string $className */
private $className;
/* @var string $color */
private $color;
/* @var string $breed */
private $breed;
}

View File

@@ -1,21 +0,0 @@
<?php
/*
* EnumTest
*/
namespace \Models;
/*
* EnumTest
*/
class EnumTest {
/* @var string $enumString */
private $enumString;
/* @var string $enumStringRequired */
private $enumStringRequired;
/* @var int $enumInteger */
private $enumInteger;
/* @var double $enumNumber */
private $enumNumber;
/* @var \\Models\OuterEnum $outerEnum */
private $outerEnum;
}

View File

@@ -1,37 +0,0 @@
<?php
/*
* FormatTest
*/
namespace \Models;
/*
* FormatTest
*/
class FormatTest {
/* @var int $integer */
private $integer;
/* @var int $int32 */
private $int32;
/* @var int $int64 */
private $int64;
/* @var float $number */
private $number;
/* @var float $float */
private $float;
/* @var double $double */
private $double;
/* @var string $string */
private $string;
/* @var string $byte */
private $byte;
/* @var \SplFileObject $binary */
private $binary;
/* @var \DateTime $date */
private $date;
/* @var \DateTime $dateTime */
private $dateTime;
/* @var string $uuid */
private $uuid;
/* @var string $password */
private $password;
}

View File

@@ -1,19 +0,0 @@
<?php
/*
* MapTest
*/
namespace \Models;
/*
* MapTest
*/
class MapTest {
/* @var map[string,map[string,string]] $mapMapOfString */
private $mapMapOfString;
/* @var map[string,string] $mapOfEnumString */
private $mapOfEnumString;
/* @var map[string,bool] $directMap */
private $directMap;
/* @var \\Models\StringBooleanMap $indirectMap */
private $indirectMap;
}

View File

@@ -1,19 +0,0 @@
<?php
/*
* Name
*/
namespace \Models;
/*
* Name
*/
class Name {
/* @var int $name */
private $name;
/* @var int $snakeCase */
private $snakeCase;
/* @var string $property */
private $property;
/* @var int $_123number */
private $_123number;
}

View File

@@ -1,23 +0,0 @@
<?php
/*
* Order
*/
namespace \Models;
/*
* Order
*/
class Order {
/* @var int $id */
private $id;
/* @var int $petId */
private $petId;
/* @var int $quantity */
private $quantity;
/* @var \DateTime $shipDate */
private $shipDate;
/* @var string $status Order Status */
private $status;
/* @var bool $complete */
private $complete;
}

View File

@@ -1,23 +0,0 @@
<?php
/*
* Pet
*/
namespace \Models;
/*
* Pet
*/
class Pet {
/* @var int $id */
private $id;
/* @var \\Models\Category $category */
private $category;
/* @var string $name */
private $name;
/* @var string[] $photoUrls */
private $photoUrls;
/* @var \\Models\Tag[] $tags */
private $tags;
/* @var string $status pet status in the store */
private $status;
}

View File

@@ -1,15 +0,0 @@
<?php
/*
* Tag
*/
namespace \Models;
/*
* Tag
*/
class Tag {
/* @var int $id */
private $id;
/* @var string $name */
private $name;
}

View File

@@ -1,27 +0,0 @@
<?php
/*
* User
*/
namespace \Models;
/*
* User
*/
class User {
/* @var int $id */
private $id;
/* @var string $username */
private $username;
/* @var string $firstName */
private $firstName;
/* @var string $lastName */
private $lastName;
/* @var string $email */
private $email;
/* @var string $password */
private $password;
/* @var string $phone */
private $phone;
/* @var int $userStatus User Status */
private $userStatus;
}

View File

@@ -0,0 +1,108 @@
<?php
/**
* SlimRouter
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPIServer;
use OpenAPIServer\Api\AnotherFakeApi;
use OpenAPIServer\Api\FakeApi;
use OpenAPIServer\Api\FakeClassnameTags123Api;
use OpenAPIServer\Api\PetApi;
use OpenAPIServer\Api\StoreApi;
use OpenAPIServer\Api\UserApi;
use Slim\App;
use Psr\Container\ContainerInterface;
use InvalidArgumentException;
/**
* SlimRouter Class Doc Comment
*
* PHP version 5
*
* @category Class
* @package OpenAPIServer\Api
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class SlimRouter {
/**
* @var $slimApp Slim\App instance
*/
private $slimApp;
/**
* Class constructor
*
* @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings
* @throws InvalidArgumentException when no container is provided that implements ContainerInterface
*/
public function __construct($container = []) {
$app = new App($container);
$app->PATCH('/v2/another-fake/dummy', AnotherFakeApi::class . ':testSpecialTags');
$app->POST('/v2/fake/outer/boolean', FakeApi::class . ':fakeOuterBooleanSerialize');
$app->POST('/v2/fake/outer/composite', FakeApi::class . ':fakeOuterCompositeSerialize');
$app->POST('/v2/fake/outer/number', FakeApi::class . ':fakeOuterNumberSerialize');
$app->POST('/v2/fake/outer/string', FakeApi::class . ':fakeOuterStringSerialize');
$app->PUT('/v2/fake/body-with-query-params', FakeApi::class . ':testBodyWithQueryParams');
$app->PATCH('/v2/fake', FakeApi::class . ':testClientModel');
$app->POST('/v2/fake', FakeApi::class . ':testEndpointParameters');
$app->GET('/v2/fake', FakeApi::class . ':testEnumParameters');
$app->POST('/v2/fake/inline-additionalProperties', FakeApi::class . ':testInlineAdditionalProperties');
$app->GET('/v2/fake/jsonFormData', FakeApi::class . ':testJsonFormData');
$app->PATCH('/v2/fake_classname_test', FakeClassnameTags123Api::class . ':testClassname');
$app->POST('/v2/pet', PetApi::class . ':addPet');
$app->GET('/v2/pet/findByStatus', PetApi::class . ':findPetsByStatus');
$app->GET('/v2/pet/findByTags', PetApi::class . ':findPetsByTags');
$app->PUT('/v2/pet', PetApi::class . ':updatePet');
$app->DELETE('/v2/pet/{petId}', PetApi::class . ':deletePet');
$app->GET('/v2/pet/{petId}', PetApi::class . ':getPetById');
$app->POST('/v2/pet/{petId}', PetApi::class . ':updatePetWithForm');
$app->POST('/v2/pet/{petId}/uploadImage', PetApi::class . ':uploadFile');
$app->POST('/v2/fake/{petId}/uploadImageWithRequiredFile', PetApi::class . ':uploadFileWithRequiredFile');
$app->GET('/v2/store/inventory', StoreApi::class . ':getInventory');
$app->POST('/v2/store/order', StoreApi::class . ':placeOrder');
$app->DELETE('/v2/store/order/{order_id}', StoreApi::class . ':deleteOrder');
$app->GET('/v2/store/order/{order_id}', StoreApi::class . ':getOrderById');
$app->POST('/v2/user', UserApi::class . ':createUser');
$app->POST('/v2/user/createWithArray', UserApi::class . ':createUsersWithArrayInput');
$app->POST('/v2/user/createWithList', UserApi::class . ':createUsersWithListInput');
$app->GET('/v2/user/login', UserApi::class . ':loginUser');
$app->GET('/v2/user/logout', UserApi::class . ':logoutUser');
$app->DELETE('/v2/user/{username}', UserApi::class . ':deleteUser');
$app->GET('/v2/user/{username}', UserApi::class . ':getUserByName');
$app->PUT('/v2/user/{username}', UserApi::class . ':updateUser');
$this->slimApp = $app;
}
/**
* Returns Slim Framework instance
* @return App
*/
public function getSlimApp() {
return $this->slimApp;
}
}