mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 02:25:20 +00:00
New PHP Slim4 Server Generator (#3658)
* [Slim4] Copy Slim3 generator as starting point * [Slim4] Add psr7Implementation generator option Slim supports PSR-7 interfaces for its Request and Response objects. Slim provides its own PSR-7 implementation so that it works out of the box. However, you are free to replace Slim’s default PSR-7 objects with a third-party implementation. [Ref] https://www.slimframework.com/docs/v4/concepts/value-objects.html * [Slim4] Handle psr7Implementation generator option It somehow ended up with composerPackages and composerDevPackages codegen variables and two additional functions. Hope, it's not too much. * [Slim4] Extend from Slim3 generator * [Slim4] Bump PHP Slim Framework version to 4.0.0 * [Slim4] Bump required PHP version to 7.1 [Upgrade Guide](https://www.slimframework.com/docs/v4/start/upgrade.html) * [Slim4] Remove app settings Slim’s App settings used to be a part of the container and they have now been decoupled from it. [Upgrade Guide](https://www.slimframework.com/docs/v4/start/upgrade.html) * [Slim4] Set container argument optional Slim uses an optional dependency container to prepare, manage, and inject application dependencies. Slim supports containers that implement PSR-11 like [PHP-DI](http://php-di.org/doc/frameworks/slim.html). [Upgrade Guide](https://www.slimframework.com/docs/v4/start/upgrade.html) * [Slim4] Change response body write You can't write to response instance directly anymore, need to retrieve body object first. [Doc](https://www.slimframework.com/docs/v4/objects/response.html#the-response-body) * [Slim4] Change Slim\App constructor [Upgrade Guide](https://www.slimframework.com/docs/v4/start/upgrade.html) * [Slim4] Refactor token authentication options User can provide array or Container as constructor argument from now. Small refactoring required to retrieve authentication options from that argument. * [Slim4] Add PSR-7 implementation codegen flags This approach seems more flexible to me. User can customize templates in favor of chosen PSR7 implementation. It's easier to change Composer packages and their versions. * [Slim4] Add JsonBodyParserMiddleware Slim4 doesn't parse JSON body, need to add suggested middleware. Ref: https://www.slimframework.com/docs/v4/objects/request.html#the-request-body * [Slim4] Remove request's deprecated methods usage Since Slim 4.0.0 ServerRequest implementation doesn't have getQueryParam and getParsedBodyParam methods anymore. * [Slim4] Use getUploadedFiles for multipart request isMultipart codegen property is always false so far. Hope that bug will be fixed soon. * [Slim4] Add samples
This commit is contained in:
parent
956029165b
commit
8e78b14e28
32
bin/openapi3/php-slim4-server-petstore.sh
Executable file
32
bin/openapi3/php-slim4-server-petstore.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/php-slim4-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php-slim4 -o samples/server/petstore/php-slim4 $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
32
bin/php-slim4-server-petstore.sh
Executable file
32
bin/php-slim4-server-petstore.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/php-slim4-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g php-slim4 -o samples/server/petstore/php-slim4 $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
@ -39,6 +39,7 @@ declare -a scripts=(
|
||||
"./bin/php-symfony-petstore.sh"
|
||||
"./bin/php-lumen-petstore-server.sh"
|
||||
"./bin/php-slim-server-petstore.sh"
|
||||
"./bin/php-slim4-server-petstore.sh"
|
||||
"./bin/php-ze-ph-petstore-server.sh"
|
||||
"./bin/openapi3/php-petstore.sh"
|
||||
"./bin/typescript-angularjs-petstore.sh"
|
||||
|
10
bin/windows/php-slim4-server-petstore.bat
Normal file
10
bin/windows/php-slim4-server-petstore.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g php-slim4 -o samples\server\petstore\php-slim4
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -104,6 +104,7 @@ The following generators are available:
|
||||
* [php-lumen](generators/php-lumen.md)
|
||||
* [php-silex](generators/php-silex.md)
|
||||
* [php-slim](generators/php-slim.md)
|
||||
* [php-slim4](generators/php-slim4.md)
|
||||
* [php-symfony](generators/php-symfony.md)
|
||||
* [php-ze-ph](generators/php-ze-ph.md)
|
||||
* [python-aiohttp](generators/python-aiohttp.md)
|
||||
|
19
docs/generators/php-slim4.md
Normal file
19
docs/generators/php-slim4.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Config Options for php-slim4
|
||||
sidebar_label: php-slim4
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPackage|package for generated models| |null|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |camelCase|
|
||||
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
|
||||
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|
||||
|srcBasePath|The directory to serve as source root.| |null|
|
||||
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|
||||
|psr7Implementation|Slim 4 provides its own PSR-7 implementation so that it works out of the box. However, you are free to replace Slim’s default PSR-7 objects with a third-party implementation. Ref: https://www.slimframework.com/docs/v4/concepts/value-objects.html|<dl><dt>**slim-psr7**</dt><dd>Slim PSR-7 Message implementation</dd><dt>**nyholm-psr7**</dt><dd>Nyholm PSR-7 Message implementation</dd><dt>**guzzle-psr7**</dt><dd>Guzzle PSR-7 Message implementation</dd><dt>**zend-diactoros**</dt><dd>Zend Diactoros PSR-7 Message implementation</dd><dl>|slim-psr7|
|
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PhpSlim4ServerCodegen.class);
|
||||
|
||||
public static final String PSR7_IMPLEMENTATION = "psr7Implementation";
|
||||
|
||||
protected String psr7Implementation = "slim-psr7";
|
||||
protected List<Map<String, String>> composerPackages = new ArrayList<Map<String, String>>();
|
||||
protected List<Map<String, String>> composerDevPackages = new ArrayList<Map<String, String>>();
|
||||
|
||||
public PhpSlim4ServerCodegen() {
|
||||
super();
|
||||
|
||||
outputFolder = "generated-code" + File.separator + "slim4";
|
||||
embeddedTemplateDir = templateDir = "php-slim4-server";
|
||||
|
||||
// override cliOptions from AbstractPhpCodegen
|
||||
updateOption(AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION, "camelCase");
|
||||
|
||||
// Slim 4 can use any PSR-7 implementation
|
||||
// https://www.slimframework.com/docs/v4/concepts/value-objects.html
|
||||
CliOption psr7Option = new CliOption(PSR7_IMPLEMENTATION,
|
||||
"Slim 4 provides its own PSR-7 implementation so that it works out of the box. However, you are free to replace Slim’s default PSR-7 objects with a third-party implementation. Ref: https://www.slimframework.com/docs/v4/concepts/value-objects.html");
|
||||
|
||||
psr7Option.addEnum("slim-psr7", "Slim PSR-7 Message implementation")
|
||||
.addEnum("nyholm-psr7", "Nyholm PSR-7 Message implementation")
|
||||
.addEnum("guzzle-psr7", "Guzzle PSR-7 Message implementation")
|
||||
.addEnum("zend-diactoros", "Zend Diactoros PSR-7 Message implementation")
|
||||
.setDefault("slim-psr7");
|
||||
|
||||
cliOptions.add(psr7Option);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "php-slim4";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a PHP Slim 4 Framework server library.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(PSR7_IMPLEMENTATION)) {
|
||||
this.setPsr7Implementation((String) additionalProperties.get(PSR7_IMPLEMENTATION));
|
||||
}
|
||||
|
||||
// reset implementation flags
|
||||
additionalProperties.put("isSlimPsr7", Boolean.FALSE);
|
||||
additionalProperties.put("isNyholmPsr7", Boolean.FALSE);
|
||||
additionalProperties.put("isGuzzlePsr7", Boolean.FALSE);
|
||||
additionalProperties.put("isZendDiactoros", Boolean.FALSE);
|
||||
|
||||
// set specific PSR-7 implementation flag
|
||||
switch (getPsr7Implementation()) {
|
||||
case "slim-psr7":
|
||||
additionalProperties.put("isSlimPsr7", Boolean.TRUE);
|
||||
break;
|
||||
case "nyholm-psr7":
|
||||
additionalProperties.put("isNyholmPsr7", Boolean.TRUE);
|
||||
break;
|
||||
case "guzzle-psr7":
|
||||
additionalProperties.put("isGuzzlePsr7", Boolean.TRUE);
|
||||
break;
|
||||
case "zend-diactoros":
|
||||
additionalProperties.put("isZendDiactoros", Boolean.TRUE);
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn("\"" + getPsr7Implementation() + "\" is invalid \"psr7Implementation\" codegen option. Default \"slim-psr7\" used instead.");
|
||||
additionalProperties.put("isSlimPsr7", Boolean.TRUE);
|
||||
}
|
||||
|
||||
// Slim 4 doesn't parse JSON body anymore we need to add suggested middleware
|
||||
// ref: https://www.slimframework.com/docs/v4/objects/request.html#the-request-body
|
||||
supportingFiles.add(new SupportingFile("json_body_parser_middleware.mustache", toSrcPath(invokerPackage + "\\Middleware", srcBasePath), "JsonBodyParserMiddleware.php"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set PSR-7 implementation package.
|
||||
* Ref: https://www.slimframework.com/docs/v4/concepts/value-objects.html
|
||||
*
|
||||
* @param psr7Implementation PSR-7 implementation package
|
||||
*/
|
||||
public void setPsr7Implementation(String psr7Implementation) {
|
||||
switch (psr7Implementation) {
|
||||
case "slim-psr7":
|
||||
case "nyholm-psr7":
|
||||
case "guzzle-psr7":
|
||||
case "zend-diactoros":
|
||||
this.psr7Implementation = psr7Implementation;
|
||||
break;
|
||||
default:
|
||||
this.psr7Implementation = "slim-psr7";
|
||||
LOGGER.warn("\"" + (String) psr7Implementation + "\" is invalid \"psr7Implementation\" argument. Default \"slim-psr7\" used instead.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns PSR-7 implementation package.
|
||||
*
|
||||
* @return PSR-7 implementation package
|
||||
*/
|
||||
public String getPsr7Implementation() {
|
||||
return this.psr7Implementation;
|
||||
}
|
||||
}
|
@ -76,6 +76,7 @@ org.openapitools.codegen.languages.PhpClientCodegen
|
||||
org.openapitools.codegen.languages.PhpLaravelServerCodegen
|
||||
org.openapitools.codegen.languages.PhpLumenServerCodegen
|
||||
org.openapitools.codegen.languages.PhpSlimServerCodegen
|
||||
org.openapitools.codegen.languages.PhpSlim4ServerCodegen
|
||||
org.openapitools.codegen.languages.PhpSilexServerCodegen
|
||||
org.openapitools.codegen.languages.PhpSymfonyServerCodegen
|
||||
org.openapitools.codegen.languages.PhpZendExpressivePathHandlerServerCodegen
|
||||
|
17
modules/openapi-generator/src/main/resources/php-slim4-server/.gitignore
vendored
Normal file
17
modules/openapi-generator/src/main/resources/php-slim4-server/.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
|
||||
|
||||
composer.phar
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
# composer.lock
|
||||
|
||||
# phplint tool creates cache file which is not necessary in a codebase
|
||||
/.phplint-cache
|
||||
|
||||
# Do not commit local PHPUnit config
|
||||
/phpunit.xml
|
||||
|
||||
# Do not commit local PHP_CodeSniffer config
|
||||
/phpcs.xml
|
@ -0,0 +1,6 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^ index.php [QSA,L]
|
||||
</IfModule>
|
189
modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache
vendored
Normal file
189
modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache
vendored
Normal file
@ -0,0 +1,189 @@
|
||||
# {{packageName}} - PHP Slim 4 Server library for {{appName}}
|
||||
|
||||
* [OpenAPI Generator](https://openapi-generator.tech)
|
||||
* [Slim 4 Documentation](https://www.slimframework.com/docs/v4/)
|
||||
|
||||
{{#isSlimPsr7}}
|
||||
This server has been generated with [Slim PSR-7](https://github.com/slimphp/Slim-Psr7) implementation.
|
||||
{{/isSlimPsr7}}
|
||||
{{#isNyholmPsr7}}
|
||||
This server has been generated with [Nyholm PSR-7](https://github.com/Nyholm/psr7) implementation and [Nyholm PSR-7 Server](https://github.com/Nyholm/psr7-server).
|
||||
{{/isNyholmPsr7}}
|
||||
{{#isGuzzlePsr7}}
|
||||
This server has been generated with [Guzzle PSR-7](https://github.com/guzzle/psr7) implementation and [Guzzle HTTP Factory](https://github.com/http-interop/http-factory-guzzle).
|
||||
{{/isGuzzlePsr7}}
|
||||
{{#isZendDiactoros}}
|
||||
This server has been generated with [Zend Diactoros](https://github.com/zendframework/zend-diactoros).
|
||||
{{/isZendDiactoros}}
|
||||
|
||||
## Requirements
|
||||
|
||||
* Web server with URL rewriting
|
||||
* PHP 7.1 or newer
|
||||
|
||||
This package contains `.htaccess` for Apache configuration.
|
||||
If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc.
|
||||
|
||||
## Installation via [Composer](https://getcomposer.org/)
|
||||
|
||||
Navigate into your project's root directory and execute the bash command shown below.
|
||||
This command downloads the Slim Framework and its third-party dependencies into your project's `vendor/` directory.
|
||||
```bash
|
||||
$ composer install
|
||||
```
|
||||
|
||||
## Start devserver
|
||||
|
||||
Run the following command in terminal to start localhost web server, assuming `./php-slim-server/` is public-accessible directory with `index.php` file:
|
||||
```bash
|
||||
$ php -S localhost:8888 -t php-slim-server
|
||||
```
|
||||
> **Warning** This web server was designed to aid application development.
|
||||
> It may also be useful for testing purposes or for application demonstrations that are run in controlled environments.
|
||||
> It is not intended to be a full-featured web server. It should not be used on a public network.
|
||||
|
||||
## Tests
|
||||
|
||||
### PHPUnit
|
||||
|
||||
This package uses PHPUnit 6 or 7(depends from your PHP version) for unit testing.
|
||||
[Test folder]({{testBasePath}}) contains templates which you can fill with real test assertions.
|
||||
How to write tests read at [PHPUnit Manual - Chapter 2. Writing Tests for PHPUnit](https://phpunit.de/manual/6.5/en/writing-tests-for-phpunit.html).
|
||||
|
||||
#### Run
|
||||
|
||||
Command | Target
|
||||
---- | ----
|
||||
`$ composer test` | All tests
|
||||
`$ composer test-apis` | Apis tests
|
||||
`$ composer test-models` | Models tests
|
||||
|
||||
#### Config
|
||||
|
||||
Package contains fully functional config `./phpunit.xml.dist` file. Create `./phpunit.xml` in root folder to override it.
|
||||
|
||||
Quote from [3. The Command-Line Test Runner — PHPUnit 7.4 Manual](https://phpunit.readthedocs.io/en/7.4/textui.html#command-line-options):
|
||||
|
||||
> If phpunit.xml or phpunit.xml.dist (in that order) exist in the current working directory and --configuration is not used, the configuration will be automatically read from that file.
|
||||
|
||||
### PHP CodeSniffer
|
||||
|
||||
[PHP CodeSniffer Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki). This tool helps to follow coding style and avoid common PHP coding mistakes.
|
||||
|
||||
#### Run
|
||||
|
||||
```bash
|
||||
$ composer phpcs
|
||||
```
|
||||
|
||||
#### Config
|
||||
|
||||
Package contains fully functional config `./phpcs.xml.dist` file. It checks source code against PSR-1 and PSR-2 coding standards.
|
||||
Create `./phpcs.xml` in root folder to override it. More info at [Using a Default Configuration File](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file)
|
||||
|
||||
### PHPLint
|
||||
|
||||
[PHPLint Documentation](https://github.com/overtrue/phplint). Checks PHP syntax only.
|
||||
|
||||
#### Run
|
||||
|
||||
```bash
|
||||
$ composer phplint
|
||||
```
|
||||
|
||||
## Show errors
|
||||
|
||||
Switch on option in `./index.php`:
|
||||
```diff
|
||||
/**
|
||||
* Add Error Handling Middleware
|
||||
*
|
||||
* @param bool $displayErrorDetails -> Should be set to false in production
|
||||
* @param bool $logErrors -> Parameter is passed to the default ErrorHandler
|
||||
* @param bool $logErrorDetails -> Display error details in error log
|
||||
* which can be replaced by a callable of your choice.
|
||||
|
||||
* Note: This middleware should be added last. It will not handle any exceptions/errors
|
||||
* for middleware added after it.
|
||||
*/
|
||||
--- $app->addErrorMiddleware(false, true, true);
|
||||
+++ $app->addErrorMiddleware(true, true, true);
|
||||
```
|
||||
|
||||
{{#generateApiDocs}}
|
||||
## API Endpoints
|
||||
|
||||
All URIs are relative to *{{{basePath}}}*
|
||||
|
||||
> Important! Do not modify abstract API controllers directly! Instead extend them by implementation classes like:
|
||||
|
||||
```php
|
||||
// src/Api/PetApi.php
|
||||
|
||||
namespace {{apiPackage}};
|
||||
|
||||
use {{apiPackage}}\AbstractPetApi;
|
||||
|
||||
class PetApi extends AbstractPetApi
|
||||
{
|
||||
|
||||
public function addPet($request, $response, $args)
|
||||
{
|
||||
// your implementation of addPet method here
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Place all your implementation classes in `./src` folder accordingly.
|
||||
For instance, when abstract class located at `./lib/Api/AbstractPetApi.php` you need to create implementation class at `./src/Api/PetApi.php`.
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | **{{operationId}}** | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
{{/generateApiDocs}}
|
||||
|
||||
{{#generateModelDocs}}
|
||||
## Models
|
||||
|
||||
{{#modelPackage}}
|
||||
{{#models}}{{#model}}* {{{modelPackage}}}\{{{classname}}}
|
||||
{{/model}}{{/models}}
|
||||
{{/modelPackage}}
|
||||
{{^modelPackage}}
|
||||
No model defined in this package
|
||||
{{/modelPackage}}
|
||||
{{/generateModelDocs}}
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
{{^hasMore}}
|
||||
## Authentication
|
||||
|
||||
{{/hasMore}}
|
||||
{{/authMethods}}
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
### Security schema `{{name}}`
|
||||
> Important! To make Basic authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{authSrcPath}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\BasicAuthenticator](./src/Auth/BasicAuthenticator.php) class.
|
||||
|
||||
{{/isBasic}}
|
||||
{{#isApiKey}}
|
||||
### Security schema `{{name}}`
|
||||
> Important! To make ApiKey authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{authSrcPath}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\ApiKeyAuthenticator](./src/Auth/ApiKeyAuthenticator.php) class.
|
||||
|
||||
{{/isApiKey}}
|
||||
{{#isOAuth}}
|
||||
### Security schema `{{name}}`
|
||||
> Important! To make OAuth authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{authSrcPath}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\OAuthAuthenticator](./src/Auth/OAuthAuthenticator.php) class.
|
||||
|
||||
Scope list:
|
||||
{{#scopes}}
|
||||
* `{{scope}}`{{#description}} - {{description}}{{/description}}
|
||||
{{/scopes}}
|
||||
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
### Advanced middleware configuration
|
||||
Ref to used Slim Token Middleware [dyorg/slim-token-authentication](https://github.com/dyorg/slim-token-authentication/tree/1.x#readme)
|
||||
{{/hasAuthMethods}}
|
294
modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache
vendored
Normal file
294
modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
<?php
|
||||
/**
|
||||
* SlimRouter
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{invokerPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**{{#apiInfo}}{{#appName}}
|
||||
* {{{appName}}}
|
||||
*
|
||||
{{/appName}}
|
||||
{{#appDescription}}
|
||||
* {{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
{{#version}}
|
||||
* The version of the OpenAPI document: {{{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}};
|
||||
|
||||
use Slim\Factory\AppFactory;
|
||||
use Slim\Interfaces\RouteInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use InvalidArgumentException;
|
||||
use Dyorg\TokenAuthentication;
|
||||
use Dyorg\TokenAuthentication\TokenSearch;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use {{invokerPackage}}\Middleware\JsonBodyParserMiddleware;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SlimRouter Class Doc Comment
|
||||
*
|
||||
* @package {{invokerPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class SlimRouter
|
||||
{
|
||||
|
||||
/** @var App instance */
|
||||
private $slimApp;
|
||||
|
||||
/** @var array[] list of all api operations */
|
||||
private $operations = [
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
[
|
||||
'httpMethod' => '{{httpMethod}}',
|
||||
'basePathWithoutHost' => '{{{basePathWithoutHost}}}',
|
||||
'path' => '{{{path}}}',
|
||||
'apiPackage' => '{{apiPackage}}',
|
||||
'classname' => '{{classname}}',
|
||||
'userClassname' => '{{userClassname}}',
|
||||
'operationId' => '{{operationId}}',
|
||||
'authMethods' => [
|
||||
{{#hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
// {{type}} security schema named '{{name}}'
|
||||
{{#isBasicBasic}}
|
||||
[
|
||||
'type' => '{{type}}',
|
||||
'isBasic' => true,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => false,
|
||||
],
|
||||
{{/isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
[
|
||||
'type' => '{{type}}',
|
||||
'isBasic' => true,
|
||||
'isBearer' => true,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => false,
|
||||
],
|
||||
{{/isBasicBearer}}
|
||||
{{#isApiKey}}
|
||||
[
|
||||
'type' => '{{type}}',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => true,
|
||||
'isOAuth' => false,
|
||||
'keyParamName' => '{{keyParamName}}',
|
||||
'isKeyInHeader' => {{#isKeyInHeader}}true{{/isKeyInHeader}}{{^isKeyInHeader}}false{{/isKeyInHeader}},
|
||||
'isKeyInQuery' => {{#isKeyInQuery}}true{{/isKeyInQuery}}{{^isKeyInQuery}}false{{/isKeyInQuery}},
|
||||
'isKeyInCookie' => {{#isKeyInCookie}}true{{/isKeyInCookie}}{{^isKeyInCookie}}false{{/isKeyInCookie}},
|
||||
],
|
||||
{{/isApiKey}}
|
||||
{{#isOAuth}}
|
||||
[
|
||||
'type' => '{{type}}',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
{{#scopes}}
|
||||
'{{scope}}',{{#description}} // {{description}}{{/description}}
|
||||
{{/scopes}}
|
||||
],
|
||||
],
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
],
|
||||
],
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
];
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings
|
||||
*
|
||||
* @throws Exception When implementation class doesn't exists
|
||||
*/
|
||||
public function __construct($settings = [])
|
||||
{
|
||||
if ($settings instanceof ContainerInterface) {
|
||||
// Set container to create App with on AppFactory
|
||||
AppFactory::setContainer($settings);
|
||||
}
|
||||
$this->slimApp = AppFactory::create();
|
||||
|
||||
// middlewares requires Psr\Container\ContainerInterface
|
||||
$container = $this->slimApp->getContainer();
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
$authPackage = '{{authPackage}}';
|
||||
$basicAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {
|
||||
$message = "How about extending {{abstractNamePrefix}}Authenticator{{abstractNameSuffix}} class by {$authPackage}\BasicAuthenticator?";
|
||||
throw new Exception($message);
|
||||
};
|
||||
$apiKeyAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {
|
||||
$message = "How about extending {{abstractNamePrefix}}Authenticator{{abstractNameSuffix}} class by {$authPackage}\ApiKeyAuthenticator?";
|
||||
throw new Exception($message);
|
||||
};
|
||||
$oAuthAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {
|
||||
$message = "How about extending {{abstractNamePrefix}}Authenticator{{abstractNameSuffix}} class by {$authPackage}\OAuthAuthenticator?";
|
||||
throw new Exception($message);
|
||||
};
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
$userOptions = null;
|
||||
if ($settings instanceof ContainerInterface && $settings->has('tokenAuthenticationOptions')) {
|
||||
$userOptions = $settings->get('tokenAuthenticationOptions');
|
||||
} elseif (is_array($settings) && isset($settings['tokenAuthenticationOptions'])) {
|
||||
$userOptions = $settings['tokenAuthenticationOptions'];
|
||||
}
|
||||
|
||||
foreach ($this->operations as $operation) {
|
||||
$callback = function ($request, $response, $arguments) use ($operation) {
|
||||
$message = "How about extending {$operation['classname']} by {$operation['apiPackage']}\\{$operation['userClassname']} class implementing {$operation['operationId']} as a {$operation['httpMethod']} method?";
|
||||
throw new Exception($message);
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
};
|
||||
$middlewares = [new JsonBodyParserMiddleware()];
|
||||
|
||||
if (class_exists("\\{$operation['apiPackage']}\\{$operation['userClassname']}")) {
|
||||
$callback = "\\{$operation['apiPackage']}\\{$operation['userClassname']}:{$operation['operationId']}";
|
||||
}
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
foreach ($operation['authMethods'] as $authMethod) {
|
||||
switch ($authMethod['type']) {
|
||||
case 'http':
|
||||
$authenticatorClassname = "\\{$authPackage}\\BasicAuthenticator";
|
||||
if (class_exists($authenticatorClassname)) {
|
||||
$basicAuthenticator = new $authenticatorClassname($container);
|
||||
}
|
||||
|
||||
$middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([
|
||||
'authenticator' => $basicAuthenticator,
|
||||
'regex' => $authMethod['isBearer'] ? '/Bearer\s+(.*)$/i' : '/Basic\s+(.*)$/i',
|
||||
'header' => 'Authorization',
|
||||
'parameter' => null,
|
||||
'cookie' => null,
|
||||
'argument' => null,
|
||||
], $userOptions));
|
||||
break;
|
||||
case 'apiKey':
|
||||
$authenticatorClassname = "\\{$authPackage}\\ApiKeyAuthenticator";
|
||||
if (class_exists($authenticatorClassname)) {
|
||||
$apiKeyAuthenticator = new $authenticatorClassname($container);
|
||||
}
|
||||
|
||||
$middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([
|
||||
'authenticator' => $apiKeyAuthenticator,
|
||||
'regex' => '/^(.*)$/i',
|
||||
'header' => $authMethod['isKeyInHeader'] ? $authMethod['keyParamName'] : null,
|
||||
'parameter' => $authMethod['isKeyInQuery'] ? $authMethod['keyParamName'] : null,
|
||||
'cookie' => $authMethod['isKeyInCookie'] ? $authMethod['keyParamName'] : null,
|
||||
'argument' => null,
|
||||
], $userOptions));
|
||||
break;
|
||||
case 'oauth2':
|
||||
$authenticatorClassname = "\\{$authPackage}\\OAuthAuthenticator";
|
||||
if (class_exists($authenticatorClassname)) {
|
||||
$oAuthAuthenticator = new $authenticatorClassname($container, $authMethod['scopes']);
|
||||
}
|
||||
|
||||
$middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([
|
||||
'authenticator' => $oAuthAuthenticator,
|
||||
'regex' => '/Bearer\s+(.*)$/i',
|
||||
'header' => 'Authorization',
|
||||
'parameter' => null,
|
||||
'cookie' => null,
|
||||
'argument' => null,
|
||||
], $userOptions));
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Unknown authorization schema type');
|
||||
}
|
||||
}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
$this->addRoute(
|
||||
[$operation['httpMethod']],
|
||||
"{$operation['basePathWithoutHost']}{$operation['path']}",
|
||||
$callback,
|
||||
$middlewares
|
||||
)->setName($operation['operationId']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges user defined options with dynamic params
|
||||
*
|
||||
* @param array $staticOptions Required static options
|
||||
* @param array $userOptions User options
|
||||
*
|
||||
* @return array Merged array
|
||||
*/
|
||||
private function getTokenAuthenticationOptions(array $staticOptions, array $userOptions = null)
|
||||
{
|
||||
if (is_array($userOptions) === false) {
|
||||
return $staticOptions;
|
||||
}
|
||||
|
||||
return array_merge($userOptions, $staticOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add route with multiple methods
|
||||
*
|
||||
* @param string[] $methods Numeric array of HTTP method names
|
||||
* @param string $pattern The route URI pattern
|
||||
* @param callable|string $callable The route callback routine
|
||||
* @param array|null $middlewares List of middlewares
|
||||
*
|
||||
* @return RouteInterface
|
||||
*
|
||||
* @throws InvalidArgumentException If the route pattern isn't a string
|
||||
*/
|
||||
public function addRoute(array $methods, string $pattern, $callable, $middlewares = [])
|
||||
{
|
||||
$route = $this->slimApp->map($methods, $pattern, $callable);
|
||||
foreach ($middlewares as $middleware) {
|
||||
$route->add($middleware);
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Slim Framework instance
|
||||
*
|
||||
* @return App
|
||||
*/
|
||||
public function getSlimApp()
|
||||
{
|
||||
return $this->slimApp;
|
||||
}
|
||||
}
|
||||
{{/apiInfo}}
|
117
modules/openapi-generator/src/main/resources/php-slim4-server/abstract_authenticator.mustache
vendored
Normal file
117
modules/openapi-generator/src/main/resources/php-slim4-server/abstract_authenticator.mustache
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* {{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{invokerPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**{{#apiInfo}}{{#appName}}
|
||||
* {{{appName}}}
|
||||
*
|
||||
{{/appName}}
|
||||
{{#appDescription}}
|
||||
* {{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
{{#version}}
|
||||
* The version of the OpenAPI document: {{{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 {{authPackage}};
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Dyorg\TokenAuthentication;
|
||||
use Dyorg\TokenAuthentication\TokenSearch;
|
||||
use Dyorg\TokenAuthentication\Exceptions\UnauthorizedExceptionInterface;
|
||||
|
||||
/**
|
||||
* {{abstractNamePrefix}}Authenticator{{abstractNameSuffix}} Class Doc Comment
|
||||
*
|
||||
* @package {{authPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class {{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var string[]|null List of required scopes
|
||||
*/
|
||||
protected $requiredScope;
|
||||
|
||||
/**
|
||||
* Verify if token is valid on database
|
||||
* If token isn't valid, expired or has insufficient scope must throw an UnauthorizedExceptionInterface
|
||||
*
|
||||
* @param string $token Api Key
|
||||
*
|
||||
* @return array User object or associative array
|
||||
* @throws UnauthorizedExceptionInterface on invalid token
|
||||
*/
|
||||
abstract protected function getUserByToken(string $token);
|
||||
|
||||
/**
|
||||
* Authenticator constructor
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
* @param string[]|null $requiredScope List of required scopes
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null, $requiredScope = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->requiredScope = $requiredScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the api key validation of your application
|
||||
*
|
||||
* Just an example of implementation. Override this method to fit your needs
|
||||
*
|
||||
* @param ServerRequestInterface $request HTTP request
|
||||
* @param TokenSearch $tokenSearch Middleware instance which contains api key in token
|
||||
*
|
||||
* @return bool Must return either true or false
|
||||
* @throws UnauthorizedExceptionInterface when cannot parse token
|
||||
*/
|
||||
public function __invoke(ServerRequestInterface &$request, TokenSearch $tokenSearch)
|
||||
{
|
||||
/**
|
||||
* Try find authorization token via header, parameters, cookie or attribute
|
||||
* If token not found, return response with status 401 (unauthorized)
|
||||
*/
|
||||
$token = $tokenSearch->getToken($request);
|
||||
|
||||
/**
|
||||
* Verify if token is valid on database
|
||||
* If token isn't valid, expired or has insufficient scope must throw an UnauthorizedExceptionInterface
|
||||
*/
|
||||
$user = $this->getUserByToken($token);
|
||||
|
||||
/**
|
||||
* Set authenticated user at attributes
|
||||
*/
|
||||
$request = $request->withAttribute('authenticated_user', $user);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
{{/apiInfo}}
|
134
modules/openapi-generator/src/main/resources/php-slim4-server/api.mustache
vendored
Normal file
134
modules/openapi-generator/src/main/resources/php-slim4-server/api.mustache
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* {{classname}}
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{apiPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
{{#appName}}
|
||||
* {{{appName}}}
|
||||
*
|
||||
{{/appName}}
|
||||
{{#appDescription}}
|
||||
* {{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
{{#version}}
|
||||
* The version of the OpenAPI document: {{{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 Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* {{classname}} Class Doc Comment
|
||||
*
|
||||
* @package {{apiPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class {{classname}}
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Route Controller constructor receives container
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
/**
|
||||
* {{httpMethod}} {{operationId}}
|
||||
{{#summary}}
|
||||
* Summary: {{summary}}
|
||||
{{/summary}}
|
||||
{{#notes}}
|
||||
* Notes: {{notes}}
|
||||
{{/notes}}
|
||||
{{#hasProduces}}
|
||||
* Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}]
|
||||
{{/hasProduces}}
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function {{operationId}}(ServerRequestInterface $request, ResponseInterface $response, array $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}} = (key_exists('{{baseName}}', $queryParams)) ? $queryParams['{{baseName}}'] : null;
|
||||
{{/queryParams}}
|
||||
{{/hasQueryParams}}
|
||||
{{#hasFormParams}}
|
||||
$body = $request->getParsedBody();
|
||||
{{#formParams}}
|
||||
{{^isFile}}
|
||||
${{paramName}} = (isset($body['{{baseName}}'])) ? $body['{{baseName}}'] : null;
|
||||
{{/isFile}}
|
||||
{{#isFile}}
|
||||
{{#isMultipart}}
|
||||
${{paramName}} = (key_exists('{{baseName}}', $request->getUploadedFiles())) ? $request->getUploadedFiles()['{{baseName}}'] : null;
|
||||
{{/isMultipart}}
|
||||
{{^isMultipart}}
|
||||
${{paramName}} = (isset($body['{{baseName}}'])) ? $body['{{baseName}}'] : null;
|
||||
{{/isMultipart}}
|
||||
{{/isFile}}
|
||||
{{/formParams}}
|
||||
{{/hasFormParams}}
|
||||
{{#hasBodyParam}}
|
||||
$body = $request->getParsedBody();
|
||||
{{/hasBodyParam}}
|
||||
$message = "How about implementing {{nickname}} as a {{httpMethod}} method in {{apiPackage}}\{{userClassname}} class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
}
|
92
modules/openapi-generator/src/main/resources/php-slim4-server/api_test.mustache
vendored
Normal file
92
modules/openapi-generator/src/main/resources/php-slim4-server/api_test.mustache
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
{{#operations}}/**
|
||||
* {{userClassname}}Test
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{apiPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
{{#appName}}
|
||||
* {{{appName}}}
|
||||
*
|
||||
{{/appName}}
|
||||
{{#appDescription}}
|
||||
* {{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
{{#version}}
|
||||
* The version of the OpenAPI document: {{{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
|
||||
* Please update the test case below to test the endpoint.
|
||||
*/
|
||||
namespace {{apiPackage}};
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use {{apiPackage}}\{{userClassname}};
|
||||
|
||||
/**
|
||||
* {{userClassname}}Test Class Doc Comment
|
||||
*
|
||||
* @package {{apiPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \{{apiPackage}}\{{userClassname}}
|
||||
*/
|
||||
class {{userClassname}}Test extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
{{#operation}}
|
||||
|
||||
/**
|
||||
* Test case for {{{operationId}}}
|
||||
*
|
||||
* {{{summary}}}.
|
||||
*
|
||||
* @covers ::{{{operationId}}}
|
||||
*/
|
||||
public function test{{operationIdCamelCase}}()
|
||||
{
|
||||
}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
52
modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache
vendored
Normal file
52
modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"minimum-stability": "RC",
|
||||
"repositories": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/ybelenko/slim-token-authentication"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"slim/slim": "^4.0",
|
||||
"dyorg/slim-token-authentication": "dev-slim4",
|
||||
{{#isSlimPsr7}}
|
||||
"slim/psr7": "^0.4.0"
|
||||
{{/isSlimPsr7}}
|
||||
{{#isNyholmPsr7}}
|
||||
"nyholm/psr7": "^1.1.0",
|
||||
"nyholm/psr7-server": "^0.3.0"
|
||||
{{/isNyholmPsr7}}
|
||||
{{#isGuzzlePsr7}}
|
||||
"guzzlehttp/psr7": "^1.6.1",
|
||||
"http-interop/http-factory-guzzle": "^1.0.0"
|
||||
{{/isGuzzlePsr7}}
|
||||
{{#isZendDiactoros}}
|
||||
"zendframework/zend-diactoros": "^2.1.3"
|
||||
{{/isZendDiactoros}}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0 || ^7.0",
|
||||
"overtrue/phplint": "^1.0",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "{{escapedInvokerPackage}}\\": [
|
||||
"{{srcBasePath}}/",
|
||||
"src/"
|
||||
]}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": { "{{escapedInvokerPackage}}\\": "{{testBasePath}}/" }
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"@test-apis",
|
||||
"@test-models"
|
||||
],
|
||||
"test-apis": "phpunit --testsuite Apis",
|
||||
"test-models": "phpunit --testsuite Models",
|
||||
"phpcs": "phpcs",
|
||||
"phplint": "phplint ./ --exclude=vendor"
|
||||
}
|
||||
}
|
75
modules/openapi-generator/src/main/resources/php-slim4-server/index.mustache
vendored
Normal file
75
modules/openapi-generator/src/main/resources/php-slim4-server/index.mustache
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
{{#apiInfo}}/**
|
||||
* {{appName}}
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{apiPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @version {{appVersion}}
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use {{invokerPackage}}\SlimRouter;
|
||||
{{/apiInfo}}
|
||||
|
||||
$config = [];
|
||||
|
||||
/**
|
||||
* Token Middleware 1.x Options
|
||||
* Options `header`, `regex`, `parameter`, `cookie`, `attribute`, `path`, `except`, `authenticator`
|
||||
* are handled by SlimRouter class. These options are ignored by app and they omitted from current
|
||||
* example.
|
||||
* Ref: https://github.com/dyorg/slim-token-authentication/tree/1.x
|
||||
*/
|
||||
$config['tokenAuthenticationOptions'] = [
|
||||
/**
|
||||
* Tokens are essentially passwords. You should treat them as such and you should always
|
||||
* use HTTPS. If the middleware detects insecure usage over HTTP it will return unathorized
|
||||
* with a message Required HTTPS for token authentication. This rule is relaxed for requests
|
||||
* on localhost. To allow insecure usage you must enable it manually by setting secure to
|
||||
* false.
|
||||
* Default: true
|
||||
*/
|
||||
// 'secure' => true,
|
||||
|
||||
/**
|
||||
* Alternatively you can list your development host to have relaxed security.
|
||||
* Default: ['localhost', '127.0.0.1']
|
||||
*/
|
||||
// 'relaxed' => ['localhost', '127.0.0.1'],
|
||||
|
||||
/**
|
||||
* By default on ocurred a fail on authentication, is sent a response on json format with a
|
||||
* message (`Invalid Token` or `Not found Token`) and with the token (if found), with status
|
||||
* `401 Unauthorized`. You can customize it by setting a callable function on error option.
|
||||
* Default: null
|
||||
*/
|
||||
// 'error' => null,
|
||||
];
|
||||
|
||||
$router = new SlimRouter($config);
|
||||
$app = $router->getSlimApp();
|
||||
|
||||
/**
|
||||
* The routing middleware should be added before the ErrorMiddleware
|
||||
* Otherwise exceptions thrown from it will not be handled
|
||||
*/
|
||||
$app->addRoutingMiddleware();
|
||||
|
||||
/**
|
||||
* Add Error Handling Middleware
|
||||
*
|
||||
* @param bool $displayErrorDetails -> Should be set to false in production
|
||||
* @param bool $logErrors -> Parameter is passed to the default ErrorHandler
|
||||
* @param bool $logErrorDetails -> Display error details in error log
|
||||
* which can be replaced by a callable of your choice.
|
||||
|
||||
* Note: This middleware should be added last. It will not handle any exceptions/errors
|
||||
* for middleware added after it.
|
||||
*/
|
||||
$app->addErrorMiddleware(false, true, true);
|
||||
|
||||
$app->run();
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* JsonBodyParserMiddleware
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{invokerPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**{{#apiInfo}}{{#appName}}
|
||||
* {{{appName}}}
|
||||
*
|
||||
{{/appName}}
|
||||
{{#appDescription}}
|
||||
* {{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
{{#version}}
|
||||
* The version of the OpenAPI document: {{{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}}\Middleware;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
/**
|
||||
* JsonBodyParserMiddleware Class Doc Comment
|
||||
*
|
||||
* @package {{invokerPackage}}\Middleware
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
final class JsonBodyParserMiddleware implements MiddlewareInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Parse incoming JSON input into a native PHP format
|
||||
* Copied from Slim4 guide
|
||||
* @ref https://www.slimframework.com/docs/v4/objects/request.html#the-request-body
|
||||
*
|
||||
* @param ServerRequestInterface $request HTTP request
|
||||
* @param RequestHandlerInterface $handler Request handler
|
||||
*
|
||||
* @return ResponseInterface HTTP response
|
||||
*/
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
$contentType = $request->getHeaderLine('Content-Type');
|
||||
|
||||
if (strstr($contentType, 'application/json')) {
|
||||
$contents = json_decode(file_get_contents('php://input'), true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
$request = $request->withParsedBody($contents);
|
||||
}
|
||||
}
|
||||
|
||||
return $handler->handle($request);
|
||||
}
|
||||
}
|
||||
{{/apiInfo}}
|
33
modules/openapi-generator/src/main/resources/php-slim4-server/model.mustache
vendored
Normal file
33
modules/openapi-generator/src/main/resources/php-slim4-server/model.mustache
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
{{#models}}{{#model}}/**
|
||||
* {{classname}}
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{modelPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace {{modelPackage}};
|
||||
|
||||
/**
|
||||
* {{classname}}
|
||||
*
|
||||
* @package {{modelPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class {{classname}}
|
||||
{
|
||||
{{#vars}}
|
||||
|
||||
/** @var {{dataType}} ${{name}} {{#description}}{{description}}{{/description}}*/
|
||||
private ${{name}};
|
||||
{{/vars}}
|
||||
}
|
||||
{{/model}}{{/models}}
|
98
modules/openapi-generator/src/main/resources/php-slim4-server/model_test.mustache
vendored
Normal file
98
modules/openapi-generator/src/main/resources/php-slim4-server/model_test.mustache
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
/**
|
||||
* {{classname}}Test
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package {{modelPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
{{#appName}}
|
||||
* {{{appName}}}
|
||||
*
|
||||
{{/appName}}
|
||||
{{#appDescription}}
|
||||
* {{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
{{#version}}
|
||||
* The version of the OpenAPI document: {{{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
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
namespace {{modelPackage}};
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use {{modelPackage}}\{{classname}};
|
||||
|
||||
/**
|
||||
* {{classname}}Test Class Doc Comment
|
||||
*
|
||||
* @package {{modelPackage}}
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \{{modelPackage}}\{{classname}}
|
||||
*/
|
||||
class {{classname}}Test extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "{{classname}}"
|
||||
*/
|
||||
public function test{{classname}}()
|
||||
{
|
||||
$test{{classname}} = new {{classname}}();
|
||||
}
|
||||
{{#vars}}
|
||||
|
||||
/**
|
||||
* Test attribute "{{name}}"
|
||||
*/
|
||||
public function testProperty{{nameInCamelCase}}()
|
||||
{
|
||||
}
|
||||
{{/vars}}
|
||||
}
|
||||
{{/model}}{{/models}}
|
31
modules/openapi-generator/src/main/resources/php-slim4-server/phpcs.xml.mustache
vendored
Normal file
31
modules/openapi-generator/src/main/resources/php-slim4-server/phpcs.xml.mustache
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="{{appName}} Config" xsi:noNamespaceSchemaLocation="phpcs.xsd">
|
||||
<description>PHP_CodeSniffer config for {{appName}}</description>
|
||||
|
||||
<!-- Path to inspected files -->
|
||||
<file>./</file>
|
||||
|
||||
<!-- Don't need to inspect installed packages -->
|
||||
<exclude-pattern>./vendor</exclude-pattern>
|
||||
|
||||
<!-- <basepath> A path to strip from the front of file paths inside reports -->
|
||||
<arg name="basepath" value="."/>
|
||||
|
||||
<!-- colors Use colors in output -->
|
||||
<arg name="colors"/>
|
||||
|
||||
<!-- Do not print warnings -->
|
||||
<!-- <arg name="warning-severity" value="0"/> -->
|
||||
|
||||
<!-- -p Show progress of the run -->
|
||||
<!-- -s Show sniff codes in all reports -->
|
||||
<arg value="ps"/>
|
||||
|
||||
<!-- Include the whole PSR12 standard -->
|
||||
<rule ref="PSR12">
|
||||
<!-- There is no way to wrap generated comments, just disable that rule for now -->
|
||||
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||
<!-- Codegen generates variables with underscore on purpose -->
|
||||
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
|
||||
</rule>
|
||||
</ruleset>
|
30
modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache
vendored
Normal file
30
modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
|
||||
bootstrap="./vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
stopOnFailure="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Apis">
|
||||
<directory>{{apiTestPath}}</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Models">
|
||||
<directory>{{modelTestPath}}</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">{{apiSrcPath}}</directory>
|
||||
<directory suffix=".php">{{modelSrcPath}}</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<ini name="error_reporting" value="E_ALL" />
|
||||
</php>
|
||||
</phpunit>
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
* Copyright 2018 SmartBear Software
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.options;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.languages.AbstractPhpCodegen;
|
||||
import org.openapitools.codegen.languages.PhpSlim4ServerCodegen;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PhpSlim4ServerOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String VARIABLE_NAMING_CONVENTION_VALUE = "camelCase";
|
||||
public static final String INVOKER_PACKAGE_VALUE = "OpenAPIServer";
|
||||
public static final String PACKAGE_NAME_VALUE = "";
|
||||
public static final String SRC_BASE_PATH_VALUE = "src";
|
||||
public static final String ARTIFACT_VERSION_VALUE = "1.0.0";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
|
||||
public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true";
|
||||
public static final String PSR7_IMPLEMENTATION_VALUE = "zend-diactoros";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "php-slim4";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION, VARIABLE_NAMING_CONVENTION_VALUE)
|
||||
.put(AbstractPhpCodegen.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(AbstractPhpCodegen.SRC_BASE_PATH, SRC_BASE_PATH_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)
|
||||
.put(PhpSlim4ServerCodegen.PSR7_IMPLEMENTATION, PSR7_IMPLEMENTATION_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.slim4;
|
||||
|
||||
import org.openapitools.codegen.languages.PhpSlim4ServerCodegen;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class PhpSlim4ServerCodegenTest {
|
||||
|
||||
@Test
|
||||
public void testEncodePath() {
|
||||
final PhpSlim4ServerCodegen codegen = new PhpSlim4ServerCodegen();
|
||||
|
||||
Assert.assertEquals(codegen.encodePath("/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r/fake"), "/%20%27%20%22%20%3Dend%20--%20%5C%5Cr%5C%5Cn%20%5C%5Cn%20%5C%5Cr/v2%20*_/%20%27%20%22%20%3Dend%20--%20%5C%5Cr%5C%5Cn%20%5C%5Cn%20%5C%5Cr/fake");
|
||||
Assert.assertEquals(codegen.encodePath("/o\'\"briens/v2/o\'\"henry/fake"), "/o%27%22briens/v2/o%27%22henry/fake");
|
||||
Assert.assertEquals(codegen.encodePath("/comedians/Chris D\'Elia"), "/comedians/Chris%20D%27Elia");
|
||||
Assert.assertEquals(codegen.encodePath("/разработчики/Юрий Беленко"), "/%D1%80%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D1%87%D0%B8%D0%BA%D0%B8/%D0%AE%D1%80%D0%B8%D0%B9%20%D0%91%D0%B5%D0%BB%D0%B5%D0%BD%D0%BA%D0%BE");
|
||||
Assert.assertEquals(codegen.encodePath("/text with multilines \\\n\\\t\\\r"), "/text%20with%20multilines%20%5C%5C%20%5C%5C%20%5C%5C");
|
||||
Assert.assertEquals(codegen.encodePath("/path with argument {value}"), "/path%20with%20argument%20{value}");
|
||||
|
||||
// few examples from Slim documentation
|
||||
Assert.assertEquals(codegen.encodePath("/users[/{id}]"), "/users[/{id}]");
|
||||
Assert.assertEquals(codegen.encodePath("/news[/{year}[/{month}]]"), "/news[/{year}[/{month}]]");
|
||||
Assert.assertEquals(codegen.encodePath("/news[/{params:.*}]"), "/news[/{params:.*}]");
|
||||
Assert.assertEquals(codegen.encodePath("/users/{id:[0-9]+}"), "/users/{id:[0-9]+}");
|
||||
|
||||
// from FastRoute\RouteParser\Std.php
|
||||
Assert.assertEquals(codegen.encodePath("/user/{name}[/{id:[0-9]+}]"), "/user/{name}[/{id:[0-9]+}]");
|
||||
Assert.assertEquals(codegen.encodePath("/fixedRoutePart/{varName}[/moreFixed/{varName2:\\d+}]"), "/fixedRoutePart/{varName}[/moreFixed/{varName2:\\d+}]");
|
||||
}
|
||||
|
||||
@Test(dataProvider = "modelFileFolderProvider")
|
||||
public void modelFileFolder(String modelPackage, String invokerPackage, String expected) {
|
||||
final PhpSlim4ServerCodegen codegen = new PhpSlim4ServerCodegen();
|
||||
codegen.setModelPackage(modelPackage);
|
||||
codegen.setInvokerPackage(invokerPackage);
|
||||
|
||||
Assert.assertEquals(codegen.modelFileFolder(), expected);
|
||||
}
|
||||
|
||||
@DataProvider(name = "modelFileFolderProvider")
|
||||
public Object[][] modelFileFolderProvider() {
|
||||
return new Object[][] {
|
||||
// {modelPackage, invokerPackage, expected}
|
||||
{"Model", "Invoker", "generated-code/slim4/lib/Model".replace('/', File.separatorChar)},
|
||||
{"Petstore", "Petstore", "generated-code/slim4/lib".replace('/', File.separatorChar)},
|
||||
{"Package\\SubPackage\\Model", "Package\\SubPackage", "generated-code/slim4/lib/Model".replace('/', File.separatorChar)},
|
||||
{"Websupport\\InvoiceValidation\\Model", "Websupport\\InvoiceValidation", "generated-code/slim4/lib/Model".replace('/', File.separatorChar)},
|
||||
};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "apiFileFolderProvider")
|
||||
public void apiFileFolder(String modelPackage, String invokerPackage, String expected) {
|
||||
final PhpSlim4ServerCodegen codegen = new PhpSlim4ServerCodegen();
|
||||
codegen.setApiPackage(modelPackage);
|
||||
codegen.setInvokerPackage(invokerPackage);
|
||||
|
||||
Assert.assertEquals(codegen.apiFileFolder(), expected);
|
||||
}
|
||||
|
||||
@DataProvider(name = "apiFileFolderProvider")
|
||||
public Object[][] apiFileFolderProvider() {
|
||||
return new Object[][] {
|
||||
// {apiPackage, invokerPackage, expected}
|
||||
{"Api", "Invoker", "generated-code/slim4/lib/Api".replace('/', File.separatorChar)},
|
||||
{"Petstore", "Petstore", "generated-code/slim4/lib".replace('/', File.separatorChar)},
|
||||
{"Package\\SubPackage\\Api", "Package\\SubPackage", "generated-code/slim4/lib/Api".replace('/', File.separatorChar)},
|
||||
{"Websupport\\InvoiceValidation\\Api", "Websupport\\InvoiceValidation", "generated-code/slim4/lib/Api".replace('/', File.separatorChar)},
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
* Copyright 2018 SmartBear Software
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.slim4;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
import org.openapitools.codegen.AbstractOptionsTest;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.languages.PhpSlim4ServerCodegen;
|
||||
import org.openapitools.codegen.options.PhpSlim4ServerOptionsProvider;
|
||||
|
||||
public class PhpSlim4ServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private PhpSlim4ServerCodegen clientCodegen;
|
||||
|
||||
public PhpSlim4ServerOptionsTest() {
|
||||
super(new PhpSlim4ServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(PhpSlim4ServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(PhpSlim4ServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setParameterNamingConvention(PhpSlim4ServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(PhpSlim4ServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPackageName(PhpSlim4ServerOptionsProvider.PACKAGE_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSrcBasePath(PhpSlim4ServerOptionsProvider.SRC_BASE_PATH_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(PhpSlim4ServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpSlim4ServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setPsr7Implementation(PhpSlim4ServerOptionsProvider.PSR7_IMPLEMENTATION_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
17
samples/server/petstore/php-slim4/.gitignore
vendored
Normal file
17
samples/server/petstore/php-slim4/.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
|
||||
|
||||
composer.phar
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
# composer.lock
|
||||
|
||||
# phplint tool creates cache file which is not necessary in a codebase
|
||||
/.phplint-cache
|
||||
|
||||
# Do not commit local PHPUnit config
|
||||
/phpunit.xml
|
||||
|
||||
# Do not commit local PHP_CodeSniffer config
|
||||
/phpcs.xml
|
6
samples/server/petstore/php-slim4/.htaccess
Normal file
6
samples/server/petstore/php-slim4/.htaccess
Normal file
@ -0,0 +1,6 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^ index.php [QSA,L]
|
||||
</IfModule>
|
23
samples/server/petstore/php-slim4/.openapi-generator-ignore
Normal file
23
samples/server/petstore/php-slim4/.openapi-generator-ignore
Normal file
@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -0,0 +1 @@
|
||||
4.2.0-SNAPSHOT
|
238
samples/server/petstore/php-slim4/README.md
Normal file
238
samples/server/petstore/php-slim4/README.md
Normal file
@ -0,0 +1,238 @@
|
||||
# php-base - PHP Slim 4 Server library for OpenAPI Petstore
|
||||
|
||||
* [OpenAPI Generator](https://openapi-generator.tech)
|
||||
* [Slim 4 Documentation](https://www.slimframework.com/docs/v4/)
|
||||
|
||||
This server has been generated with [Slim PSR-7](https://github.com/slimphp/Slim-Psr7) implementation.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Web server with URL rewriting
|
||||
* PHP 7.1 or newer
|
||||
|
||||
This package contains `.htaccess` for Apache configuration.
|
||||
If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc.
|
||||
|
||||
## Installation via [Composer](https://getcomposer.org/)
|
||||
|
||||
Navigate into your project's root directory and execute the bash command shown below.
|
||||
This command downloads the Slim Framework and its third-party dependencies into your project's `vendor/` directory.
|
||||
```bash
|
||||
$ composer install
|
||||
```
|
||||
|
||||
## Start devserver
|
||||
|
||||
Run the following command in terminal to start localhost web server, assuming `./php-slim-server/` is public-accessible directory with `index.php` file:
|
||||
```bash
|
||||
$ php -S localhost:8888 -t php-slim-server
|
||||
```
|
||||
> **Warning** This web server was designed to aid application development.
|
||||
> It may also be useful for testing purposes or for application demonstrations that are run in controlled environments.
|
||||
> It is not intended to be a full-featured web server. It should not be used on a public network.
|
||||
|
||||
## Tests
|
||||
|
||||
### PHPUnit
|
||||
|
||||
This package uses PHPUnit 6 or 7(depends from your PHP version) for unit testing.
|
||||
[Test folder](test) contains templates which you can fill with real test assertions.
|
||||
How to write tests read at [PHPUnit Manual - Chapter 2. Writing Tests for PHPUnit](https://phpunit.de/manual/6.5/en/writing-tests-for-phpunit.html).
|
||||
|
||||
#### Run
|
||||
|
||||
Command | Target
|
||||
---- | ----
|
||||
`$ composer test` | All tests
|
||||
`$ composer test-apis` | Apis tests
|
||||
`$ composer test-models` | Models tests
|
||||
|
||||
#### Config
|
||||
|
||||
Package contains fully functional config `./phpunit.xml.dist` file. Create `./phpunit.xml` in root folder to override it.
|
||||
|
||||
Quote from [3. The Command-Line Test Runner — PHPUnit 7.4 Manual](https://phpunit.readthedocs.io/en/7.4/textui.html#command-line-options):
|
||||
|
||||
> If phpunit.xml or phpunit.xml.dist (in that order) exist in the current working directory and --configuration is not used, the configuration will be automatically read from that file.
|
||||
|
||||
### PHP CodeSniffer
|
||||
|
||||
[PHP CodeSniffer Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki). This tool helps to follow coding style and avoid common PHP coding mistakes.
|
||||
|
||||
#### Run
|
||||
|
||||
```bash
|
||||
$ composer phpcs
|
||||
```
|
||||
|
||||
#### Config
|
||||
|
||||
Package contains fully functional config `./phpcs.xml.dist` file. It checks source code against PSR-1 and PSR-2 coding standards.
|
||||
Create `./phpcs.xml` in root folder to override it. More info at [Using a Default Configuration File](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file)
|
||||
|
||||
### PHPLint
|
||||
|
||||
[PHPLint Documentation](https://github.com/overtrue/phplint). Checks PHP syntax only.
|
||||
|
||||
#### Run
|
||||
|
||||
```bash
|
||||
$ composer phplint
|
||||
```
|
||||
|
||||
## Show errors
|
||||
|
||||
Switch on option in `./index.php`:
|
||||
```diff
|
||||
/**
|
||||
* Add Error Handling Middleware
|
||||
*
|
||||
* @param bool $displayErrorDetails -> Should be set to false in production
|
||||
* @param bool $logErrors -> Parameter is passed to the default ErrorHandler
|
||||
* @param bool $logErrorDetails -> Display error details in error log
|
||||
* which can be replaced by a callable of your choice.
|
||||
|
||||
* Note: This middleware should be added last. It will not handle any exceptions/errors
|
||||
* for middleware added after it.
|
||||
*/
|
||||
--- $app->addErrorMiddleware(false, true, true);
|
||||
+++ $app->addErrorMiddleware(true, true, true);
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
> Important! Do not modify abstract API controllers directly! Instead extend them by implementation classes like:
|
||||
|
||||
```php
|
||||
// src/Api/PetApi.php
|
||||
|
||||
namespace OpenAPIServer\Api;
|
||||
|
||||
use OpenAPIServer\Api\AbstractPetApi;
|
||||
|
||||
class PetApi extends AbstractPetApi
|
||||
{
|
||||
|
||||
public function addPet($request, $response, $args)
|
||||
{
|
||||
// your implementation of addPet method here
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Place all your implementation classes in `./src` folder accordingly.
|
||||
For instance, when abstract class located at `./lib/Api/AbstractPetApi.php` you need to create implementation class at `./src/Api/PetApi.php`.
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*AbstractAnotherFakeApi* | **call123TestSpecialTags** | **PATCH** /another-fake/dummy | To test special tags
|
||||
*AbstractFakeApi* | **createXmlItem** | **POST** /fake/create_xml_item | creates an XmlItem
|
||||
*AbstractFakeApi* | **fakeOuterBooleanSerialize** | **POST** /fake/outer/boolean |
|
||||
*AbstractFakeApi* | **fakeOuterCompositeSerialize** | **POST** /fake/outer/composite |
|
||||
*AbstractFakeApi* | **fakeOuterNumberSerialize** | **POST** /fake/outer/number |
|
||||
*AbstractFakeApi* | **fakeOuterStringSerialize** | **POST** /fake/outer/string |
|
||||
*AbstractFakeApi* | **testBodyWithFileSchema** | **PUT** /fake/body-with-file-schema |
|
||||
*AbstractFakeApi* | **testBodyWithQueryParams** | **PUT** /fake/body-with-query-params |
|
||||
*AbstractFakeApi* | **testClientModel** | **PATCH** /fake | To test \"client\" model
|
||||
*AbstractFakeApi* | **testEndpointParameters** | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*AbstractFakeApi* | **testEnumParameters** | **GET** /fake | To test enum parameters
|
||||
*AbstractFakeApi* | **testGroupParameters** | **DELETE** /fake | Fake endpoint to test group parameters (optional)
|
||||
*AbstractFakeApi* | **testInlineAdditionalProperties** | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||
*AbstractFakeApi* | **testJsonFormData** | **GET** /fake/jsonFormData | test json serialization of form data
|
||||
*AbstractFakeApi* | **testQueryParameterCollectionFormat** | **PUT** /fake/test-query-paramters |
|
||||
*AbstractFakeClassnameTags123Api* | **testClassname** | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*AbstractPetApi* | **addPet** | **POST** /pet | Add a new pet to the store
|
||||
*AbstractPetApi* | **findPetsByStatus** | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*AbstractPetApi* | **findPetsByTags** | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*AbstractPetApi* | **updatePet** | **PUT** /pet | Update an existing pet
|
||||
*AbstractPetApi* | **deletePet** | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*AbstractPetApi* | **getPetById** | **GET** /pet/{petId} | Find pet by ID
|
||||
*AbstractPetApi* | **updatePetWithForm** | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*AbstractPetApi* | **uploadFile** | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*AbstractPetApi* | **uploadFileWithRequiredFile** | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
|
||||
*AbstractStoreApi* | **getInventory** | **GET** /store/inventory | Returns pet inventories by status
|
||||
*AbstractStoreApi* | **placeOrder** | **POST** /store/order | Place an order for a pet
|
||||
*AbstractStoreApi* | **deleteOrder** | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*AbstractStoreApi* | **getOrderById** | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*AbstractUserApi* | **createUser** | **POST** /user | Create user
|
||||
*AbstractUserApi* | **createUsersWithArrayInput** | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*AbstractUserApi* | **createUsersWithListInput** | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*AbstractUserApi* | **loginUser** | **GET** /user/login | Logs user into the system
|
||||
*AbstractUserApi* | **logoutUser** | **GET** /user/logout | Logs out current logged in user session
|
||||
*AbstractUserApi* | **deleteUser** | **DELETE** /user/{username} | Delete user
|
||||
*AbstractUserApi* | **getUserByName** | **GET** /user/{username} | Get user by user name
|
||||
*AbstractUserApi* | **updateUser** | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Models
|
||||
|
||||
* OpenAPIServer\Model\AdditionalPropertiesAnyType
|
||||
* OpenAPIServer\Model\AdditionalPropertiesArray
|
||||
* OpenAPIServer\Model\AdditionalPropertiesBoolean
|
||||
* OpenAPIServer\Model\AdditionalPropertiesClass
|
||||
* OpenAPIServer\Model\AdditionalPropertiesInteger
|
||||
* OpenAPIServer\Model\AdditionalPropertiesNumber
|
||||
* OpenAPIServer\Model\AdditionalPropertiesObject
|
||||
* OpenAPIServer\Model\AdditionalPropertiesString
|
||||
* OpenAPIServer\Model\Animal
|
||||
* OpenAPIServer\Model\ApiResponse
|
||||
* OpenAPIServer\Model\ArrayOfArrayOfNumberOnly
|
||||
* OpenAPIServer\Model\ArrayOfNumberOnly
|
||||
* OpenAPIServer\Model\ArrayTest
|
||||
* OpenAPIServer\Model\Capitalization
|
||||
* OpenAPIServer\Model\Cat
|
||||
* OpenAPIServer\Model\CatAllOf
|
||||
* OpenAPIServer\Model\Category
|
||||
* OpenAPIServer\Model\ClassModel
|
||||
* OpenAPIServer\Model\Client
|
||||
* OpenAPIServer\Model\Dog
|
||||
* OpenAPIServer\Model\DogAllOf
|
||||
* OpenAPIServer\Model\EnumArrays
|
||||
* OpenAPIServer\Model\EnumClass
|
||||
* OpenAPIServer\Model\EnumTest
|
||||
* OpenAPIServer\Model\File
|
||||
* OpenAPIServer\Model\FileSchemaTestClass
|
||||
* OpenAPIServer\Model\FormatTest
|
||||
* OpenAPIServer\Model\HasOnlyReadOnly
|
||||
* OpenAPIServer\Model\MapTest
|
||||
* OpenAPIServer\Model\MixedPropertiesAndAdditionalPropertiesClass
|
||||
* OpenAPIServer\Model\Model200Response
|
||||
* OpenAPIServer\Model\ModelList
|
||||
* OpenAPIServer\Model\ModelReturn
|
||||
* OpenAPIServer\Model\Name
|
||||
* OpenAPIServer\Model\NumberOnly
|
||||
* OpenAPIServer\Model\Order
|
||||
* OpenAPIServer\Model\OuterComposite
|
||||
* OpenAPIServer\Model\OuterEnum
|
||||
* OpenAPIServer\Model\Pet
|
||||
* OpenAPIServer\Model\ReadOnlyFirst
|
||||
* OpenAPIServer\Model\SpecialModelName
|
||||
* OpenAPIServer\Model\Tag
|
||||
* OpenAPIServer\Model\TypeHolderDefault
|
||||
* OpenAPIServer\Model\TypeHolderExample
|
||||
* OpenAPIServer\Model\User
|
||||
* OpenAPIServer\Model\XmlItem
|
||||
|
||||
|
||||
## Authentication
|
||||
|
||||
### Security schema `api_key`
|
||||
> Important! To make ApiKey authentication work you need to extend [\OpenAPIServer\Auth\AbstractAuthenticator](./lib/Auth/AbstractAuthenticator.php) class by [\OpenAPIServer\Auth\ApiKeyAuthenticator](./src/Auth/ApiKeyAuthenticator.php) class.
|
||||
|
||||
### Security schema `api_key_query`
|
||||
> Important! To make ApiKey authentication work you need to extend [\OpenAPIServer\Auth\AbstractAuthenticator](./lib/Auth/AbstractAuthenticator.php) class by [\OpenAPIServer\Auth\ApiKeyAuthenticator](./src/Auth/ApiKeyAuthenticator.php) class.
|
||||
|
||||
### Security schema `http_basic_test`
|
||||
> Important! To make Basic authentication work you need to extend [\OpenAPIServer\Auth\AbstractAuthenticator](./lib/Auth/AbstractAuthenticator.php) class by [\OpenAPIServer\Auth\BasicAuthenticator](./src/Auth/BasicAuthenticator.php) class.
|
||||
|
||||
### Security schema `petstore_auth`
|
||||
> Important! To make OAuth authentication work you need to extend [\OpenAPIServer\Auth\AbstractAuthenticator](./lib/Auth/AbstractAuthenticator.php) class by [\OpenAPIServer\Auth\OAuthAuthenticator](./src/Auth/OAuthAuthenticator.php) class.
|
||||
|
||||
Scope list:
|
||||
* `write:pets` - modify pets in your account
|
||||
* `read:pets` - read your pets
|
||||
|
||||
### Advanced middleware configuration
|
||||
Ref to used Slim Token Middleware [dyorg/slim-token-authentication](https://github.com/dyorg/slim-token-authentication/tree/1.x#readme)
|
39
samples/server/petstore/php-slim4/composer.json
Normal file
39
samples/server/petstore/php-slim4/composer.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"minimum-stability": "RC",
|
||||
"repositories": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/ybelenko/slim-token-authentication"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"slim/slim": "^4.0",
|
||||
"dyorg/slim-token-authentication": "dev-slim4",
|
||||
"slim/psr7": "^0.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0 || ^7.0",
|
||||
"overtrue/phplint": "^1.0",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "OpenAPIServer\\": [
|
||||
"lib/",
|
||||
"src/"
|
||||
]}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": { "OpenAPIServer\\": "test/" }
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"@test-apis",
|
||||
"@test-models"
|
||||
],
|
||||
"test-apis": "phpunit --testsuite Apis",
|
||||
"test-models": "phpunit --testsuite Models",
|
||||
"phpcs": "phpcs",
|
||||
"phplint": "phplint ./ --exclude=vendor"
|
||||
}
|
||||
}
|
74
samples/server/petstore/php-slim4/index.php
Normal file
74
samples/server/petstore/php-slim4/index.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @version 1.0.0
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use OpenAPIServer\SlimRouter;
|
||||
|
||||
$config = [];
|
||||
|
||||
/**
|
||||
* Token Middleware 1.x Options
|
||||
* Options `header`, `regex`, `parameter`, `cookie`, `attribute`, `path`, `except`, `authenticator`
|
||||
* are handled by SlimRouter class. These options are ignored by app and they omitted from current
|
||||
* example.
|
||||
* Ref: https://github.com/dyorg/slim-token-authentication/tree/1.x
|
||||
*/
|
||||
$config['tokenAuthenticationOptions'] = [
|
||||
/**
|
||||
* Tokens are essentially passwords. You should treat them as such and you should always
|
||||
* use HTTPS. If the middleware detects insecure usage over HTTP it will return unathorized
|
||||
* with a message Required HTTPS for token authentication. This rule is relaxed for requests
|
||||
* on localhost. To allow insecure usage you must enable it manually by setting secure to
|
||||
* false.
|
||||
* Default: true
|
||||
*/
|
||||
// 'secure' => true,
|
||||
|
||||
/**
|
||||
* Alternatively you can list your development host to have relaxed security.
|
||||
* Default: ['localhost', '127.0.0.1']
|
||||
*/
|
||||
// 'relaxed' => ['localhost', '127.0.0.1'],
|
||||
|
||||
/**
|
||||
* By default on ocurred a fail on authentication, is sent a response on json format with a
|
||||
* message (`Invalid Token` or `Not found Token`) and with the token (if found), with status
|
||||
* `401 Unauthorized`. You can customize it by setting a callable function on error option.
|
||||
* Default: null
|
||||
*/
|
||||
// 'error' => null,
|
||||
];
|
||||
|
||||
$router = new SlimRouter($config);
|
||||
$app = $router->getSlimApp();
|
||||
|
||||
/**
|
||||
* The routing middleware should be added before the ErrorMiddleware
|
||||
* Otherwise exceptions thrown from it will not be handled
|
||||
*/
|
||||
$app->addRoutingMiddleware();
|
||||
|
||||
/**
|
||||
* Add Error Handling Middleware
|
||||
*
|
||||
* @param bool $displayErrorDetails -> Should be set to false in production
|
||||
* @param bool $logErrors -> Parameter is passed to the default ErrorHandler
|
||||
* @param bool $logErrorDetails -> Display error details in error log
|
||||
* which can be replaced by a callable of your choice.
|
||||
|
||||
* Note: This middleware should be added last. It will not handle any exceptions/errors
|
||||
* for middleware added after it.
|
||||
*/
|
||||
$app->addErrorMiddleware(false, true, true);
|
||||
|
||||
$app->run();
|
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* AbstractAnotherFakeApi
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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 Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* AbstractAnotherFakeApi Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class AbstractAnotherFakeApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Route Controller constructor receives container
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PATCH call123TestSpecialTags
|
||||
* Summary: To test special tags
|
||||
* Notes: To test special tags and operation ID starting with number
|
||||
* Output-Formats: [application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function call123TestSpecialTags(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing call123TestSpecialTags as a PATCH method in OpenAPIServer\Api\AnotherFakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
}
|
400
samples/server/petstore/php-slim4/lib/Api/AbstractFakeApi.php
Normal file
400
samples/server/petstore/php-slim4/lib/Api/AbstractFakeApi.php
Normal file
@ -0,0 +1,400 @@
|
||||
<?php
|
||||
/**
|
||||
* AbstractFakeApi
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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 Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* AbstractFakeApi Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class AbstractFakeApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Route Controller constructor receives container
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* POST createXmlItem
|
||||
* Summary: creates an XmlItem
|
||||
* Notes: this route creates an XmlItem
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function createXmlItem(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing createXmlItem as a POST method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST fakeOuterBooleanSerialize
|
||||
* Notes: Test serialization of outer boolean types
|
||||
* Output-Formats: [*_/_*]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function fakeOuterBooleanSerialize(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing fakeOuterBooleanSerialize as a POST method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST fakeOuterCompositeSerialize
|
||||
* Notes: Test serialization of object with outer number type
|
||||
* Output-Formats: [*_/_*]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function fakeOuterCompositeSerialize(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing fakeOuterCompositeSerialize as a POST method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST fakeOuterNumberSerialize
|
||||
* Notes: Test serialization of outer number types
|
||||
* Output-Formats: [*_/_*]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function fakeOuterNumberSerialize(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing fakeOuterNumberSerialize as a POST method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST fakeOuterStringSerialize
|
||||
* Notes: Test serialization of outer string types
|
||||
* Output-Formats: [*_/_*]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function fakeOuterStringSerialize(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing fakeOuterStringSerialize as a POST method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT testBodyWithFileSchema
|
||||
* Notes: For this test, the body for this request much reference a schema named `File`.
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testBodyWithFileSchema(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing testBodyWithFileSchema as a PUT method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT testBodyWithQueryParams
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testBodyWithQueryParams(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$queryParams = $request->getQueryParams();
|
||||
$query = (key_exists('query', $queryParams)) ? $queryParams['query'] : null;
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing testBodyWithQueryParams as a PUT method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* PATCH testClientModel
|
||||
* Summary: To test \"client\" model
|
||||
* Notes: To test \"client\" model
|
||||
* Output-Formats: [application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testClientModel(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing testClientModel as a PATCH method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST testEndpointParameters
|
||||
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testEndpointParameters(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$integer = (isset($body['integer'])) ? $body['integer'] : null;
|
||||
$int32 = (isset($body['int32'])) ? $body['int32'] : null;
|
||||
$int64 = (isset($body['int64'])) ? $body['int64'] : null;
|
||||
$number = (isset($body['number'])) ? $body['number'] : null;
|
||||
$float = (isset($body['float'])) ? $body['float'] : null;
|
||||
$double = (isset($body['double'])) ? $body['double'] : null;
|
||||
$string = (isset($body['string'])) ? $body['string'] : null;
|
||||
$patternWithoutDelimiter = (isset($body['pattern_without_delimiter'])) ? $body['pattern_without_delimiter'] : null;
|
||||
$byte = (isset($body['byte'])) ? $body['byte'] : null;
|
||||
$binary = (isset($body['binary'])) ? $body['binary'] : null;
|
||||
$date = (isset($body['date'])) ? $body['date'] : null;
|
||||
$dateTime = (isset($body['dateTime'])) ? $body['dateTime'] : null;
|
||||
$password = (isset($body['password'])) ? $body['password'] : null;
|
||||
$callback = (isset($body['callback'])) ? $body['callback'] : null;
|
||||
$message = "How about implementing testEndpointParameters as a POST method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET testEnumParameters
|
||||
* Summary: To test enum parameters
|
||||
* Notes: To test enum parameters
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testEnumParameters(ServerRequestInterface $request, ResponseInterface $response, array $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 = (key_exists('enum_query_string_array', $queryParams)) ? $queryParams['enum_query_string_array'] : null;
|
||||
$enumQueryString = (key_exists('enum_query_string', $queryParams)) ? $queryParams['enum_query_string'] : null;
|
||||
$enumQueryInteger = (key_exists('enum_query_integer', $queryParams)) ? $queryParams['enum_query_integer'] : null;
|
||||
$enumQueryDouble = (key_exists('enum_query_double', $queryParams)) ? $queryParams['enum_query_double'] : null;
|
||||
$body = $request->getParsedBody();
|
||||
$enumFormStringArray = (isset($body['enum_form_string_array'])) ? $body['enum_form_string_array'] : null;
|
||||
$enumFormString = (isset($body['enum_form_string'])) ? $body['enum_form_string'] : null;
|
||||
$message = "How about implementing testEnumParameters as a GET method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE testGroupParameters
|
||||
* Summary: Fake endpoint to test group parameters (optional)
|
||||
* Notes: Fake endpoint to test group parameters (optional)
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testGroupParameters(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$headers = $request->getHeaders();
|
||||
$requiredBooleanGroup = $request->hasHeader('required_boolean_group') ? $headers['required_boolean_group'] : null;
|
||||
$booleanGroup = $request->hasHeader('boolean_group') ? $headers['boolean_group'] : null;
|
||||
$queryParams = $request->getQueryParams();
|
||||
$requiredStringGroup = (key_exists('required_string_group', $queryParams)) ? $queryParams['required_string_group'] : null;
|
||||
$requiredInt64Group = (key_exists('required_int64_group', $queryParams)) ? $queryParams['required_int64_group'] : null;
|
||||
$stringGroup = (key_exists('string_group', $queryParams)) ? $queryParams['string_group'] : null;
|
||||
$int64Group = (key_exists('int64_group', $queryParams)) ? $queryParams['int64_group'] : null;
|
||||
$message = "How about implementing testGroupParameters as a DELETE method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST testInlineAdditionalProperties
|
||||
* Summary: test inline additionalProperties
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testInlineAdditionalProperties(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing testInlineAdditionalProperties as a POST method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET testJsonFormData
|
||||
* Summary: test json serialization of form data
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testJsonFormData(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$param = (isset($body['param'])) ? $body['param'] : null;
|
||||
$param2 = (isset($body['param2'])) ? $body['param2'] : null;
|
||||
$message = "How about implementing testJsonFormData as a GET method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT testQueryParameterCollectionFormat
|
||||
* Notes: To test the collection format in query parameters
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testQueryParameterCollectionFormat(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$queryParams = $request->getQueryParams();
|
||||
$pipe = (key_exists('pipe', $queryParams)) ? $queryParams['pipe'] : null;
|
||||
$ioutil = (key_exists('ioutil', $queryParams)) ? $queryParams['ioutil'] : null;
|
||||
$http = (key_exists('http', $queryParams)) ? $queryParams['http'] : null;
|
||||
$url = (key_exists('url', $queryParams)) ? $queryParams['url'] : null;
|
||||
$context = (key_exists('context', $queryParams)) ? $queryParams['context'] : null;
|
||||
$message = "How about implementing testQueryParameterCollectionFormat as a PUT method in OpenAPIServer\Api\FakeApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* AbstractFakeClassnameTags123Api
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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 Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* AbstractFakeClassnameTags123Api Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class AbstractFakeClassnameTags123Api
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Route Controller constructor receives container
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PATCH testClassname
|
||||
* Summary: To test class name in snake case
|
||||
* Notes: To test class name in snake case
|
||||
* Output-Formats: [application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function testClassname(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing testClassname as a PATCH method in OpenAPIServer\Api\FakeClassnameTags123Api class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
}
|
267
samples/server/petstore/php-slim4/lib/Api/AbstractPetApi.php
Normal file
267
samples/server/petstore/php-slim4/lib/Api/AbstractPetApi.php
Normal file
@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/**
|
||||
* AbstractPetApi
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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 Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* AbstractPetApi Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class AbstractPetApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Route Controller constructor receives container
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* POST addPet
|
||||
* Summary: Add a new pet to the store
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function addPet(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing addPet as a POST method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE deletePet
|
||||
* Summary: Deletes a pet
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function deletePet(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$headers = $request->getHeaders();
|
||||
$apiKey = $request->hasHeader('api_key') ? $headers['api_key'] : null;
|
||||
$petId = $args['petId'];
|
||||
$message = "How about implementing deletePet as a DELETE method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function findPetsByStatus(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$queryParams = $request->getQueryParams();
|
||||
$status = (key_exists('status', $queryParams)) ? $queryParams['status'] : null;
|
||||
$message = "How about implementing findPetsByStatus as a GET method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function findPetsByTags(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$queryParams = $request->getQueryParams();
|
||||
$tags = (key_exists('tags', $queryParams)) ? $queryParams['tags'] : null;
|
||||
$message = "How about implementing findPetsByTags as a GET method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET getPetById
|
||||
* Summary: Find pet by ID
|
||||
* Notes: Returns a single pet
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function getPetById(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$petId = $args['petId'];
|
||||
$message = "How about implementing getPetById as a GET method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT updatePet
|
||||
* Summary: Update an existing pet
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function updatePet(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing updatePet as a PUT method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST updatePetWithForm
|
||||
* Summary: Updates a pet in the store with form data
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function updatePetWithForm(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$petId = $args['petId'];
|
||||
$body = $request->getParsedBody();
|
||||
$name = (isset($body['name'])) ? $body['name'] : null;
|
||||
$status = (isset($body['status'])) ? $body['status'] : null;
|
||||
$message = "How about implementing updatePetWithForm as a POST method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST uploadFile
|
||||
* Summary: uploads an image
|
||||
* Output-Formats: [application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function uploadFile(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$petId = $args['petId'];
|
||||
$body = $request->getParsedBody();
|
||||
$additionalMetadata = (isset($body['additionalMetadata'])) ? $body['additionalMetadata'] : null;
|
||||
$file = (key_exists('file', $request->getUploadedFiles())) ? $request->getUploadedFiles()['file'] : null;
|
||||
$message = "How about implementing uploadFile as a POST method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST uploadFileWithRequiredFile
|
||||
* Summary: uploads an image (required)
|
||||
* Output-Formats: [application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function uploadFileWithRequiredFile(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$petId = $args['petId'];
|
||||
$body = $request->getParsedBody();
|
||||
$additionalMetadata = (isset($body['additionalMetadata'])) ? $body['additionalMetadata'] : null;
|
||||
$requiredFile = (key_exists('requiredFile', $request->getUploadedFiles())) ? $request->getUploadedFiles()['requiredFile'] : null;
|
||||
$message = "How about implementing uploadFileWithRequiredFile as a POST method in OpenAPIServer\Api\PetApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
}
|
146
samples/server/petstore/php-slim4/lib/Api/AbstractStoreApi.php
Normal file
146
samples/server/petstore/php-slim4/lib/Api/AbstractStoreApi.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
* AbstractStoreApi
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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 Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* AbstractStoreApi Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class AbstractStoreApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Route Controller constructor receives container
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DELETE deleteOrder
|
||||
* Summary: Delete purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function deleteOrder(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$orderId = $args['order_id'];
|
||||
$message = "How about implementing deleteOrder as a DELETE method in OpenAPIServer\Api\StoreApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET getInventory
|
||||
* Summary: Returns pet inventories by status
|
||||
* Notes: Returns a map of status codes to quantities
|
||||
* Output-Formats: [application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function getInventory(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$message = "How about implementing getInventory as a GET method in OpenAPIServer\Api\StoreApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET getOrderById
|
||||
* Summary: Find purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function getOrderById(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$orderId = $args['order_id'];
|
||||
$message = "How about implementing getOrderById as a GET method in OpenAPIServer\Api\StoreApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST placeOrder
|
||||
* Summary: Place an order for a pet
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function placeOrder(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing placeOrder as a POST method in OpenAPIServer\Api\StoreApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
}
|
232
samples/server/petstore/php-slim4/lib/Api/AbstractUserApi.php
Normal file
232
samples/server/petstore/php-slim4/lib/Api/AbstractUserApi.php
Normal file
@ -0,0 +1,232 @@
|
||||
<?php
|
||||
/**
|
||||
* AbstractUserApi
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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 Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* AbstractUserApi Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class AbstractUserApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Route Controller constructor receives container
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* POST createUser
|
||||
* Summary: Create user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function createUser(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing createUser as a POST method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST createUsersWithArrayInput
|
||||
* Summary: Creates list of users with given input array
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function createUsersWithArrayInput(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing createUsersWithArrayInput as a POST method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST createUsersWithListInput
|
||||
* Summary: Creates list of users with given input array
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function createUsersWithListInput(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing createUsersWithListInput as a POST method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE deleteUser
|
||||
* Summary: Delete user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function deleteUser(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$username = $args['username'];
|
||||
$message = "How about implementing deleteUser as a DELETE method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET getUserByName
|
||||
* Summary: Get user by user name
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function getUserByName(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$username = $args['username'];
|
||||
$message = "How about implementing getUserByName as a GET method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET loginUser
|
||||
* Summary: Logs user into the system
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function loginUser(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$queryParams = $request->getQueryParams();
|
||||
$username = (key_exists('username', $queryParams)) ? $queryParams['username'] : null;
|
||||
$password = (key_exists('password', $queryParams)) ? $queryParams['password'] : null;
|
||||
$message = "How about implementing loginUser as a GET method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET logoutUser
|
||||
* Summary: Logs out current logged in user session
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function logoutUser(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$message = "How about implementing logoutUser as a GET method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT updateUser
|
||||
* Summary: Updated user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
*
|
||||
* @param ServerRequestInterface $request Request
|
||||
* @param ResponseInterface $response Response
|
||||
* @param array|null $args Path arguments
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception to force implementation class to override this method
|
||||
*/
|
||||
public function updateUser(ServerRequestInterface $request, ResponseInterface $response, array $args)
|
||||
{
|
||||
$username = $args['username'];
|
||||
$body = $request->getParsedBody();
|
||||
$message = "How about implementing updateUser as a PUT method in OpenAPIServer\Api\UserApi class?";
|
||||
throw new Exception($message);
|
||||
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* AbstractAuthenticator
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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\Auth;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Dyorg\TokenAuthentication;
|
||||
use Dyorg\TokenAuthentication\TokenSearch;
|
||||
use Dyorg\TokenAuthentication\Exceptions\UnauthorizedExceptionInterface;
|
||||
|
||||
/**
|
||||
* AbstractAuthenticator Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Auth
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
abstract class AbstractAuthenticator
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ContainerInterface|null Slim app container instance
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var string[]|null List of required scopes
|
||||
*/
|
||||
protected $requiredScope;
|
||||
|
||||
/**
|
||||
* Verify if token is valid on database
|
||||
* If token isn't valid, expired or has insufficient scope must throw an UnauthorizedExceptionInterface
|
||||
*
|
||||
* @param string $token Api Key
|
||||
*
|
||||
* @return array User object or associative array
|
||||
* @throws UnauthorizedExceptionInterface on invalid token
|
||||
*/
|
||||
abstract protected function getUserByToken(string $token);
|
||||
|
||||
/**
|
||||
* Authenticator constructor
|
||||
*
|
||||
* @param ContainerInterface|null $container Slim app container instance
|
||||
* @param string[]|null $requiredScope List of required scopes
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null, $requiredScope = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->requiredScope = $requiredScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the api key validation of your application
|
||||
*
|
||||
* Just an example of implementation. Override this method to fit your needs
|
||||
*
|
||||
* @param ServerRequestInterface $request HTTP request
|
||||
* @param TokenSearch $tokenSearch Middleware instance which contains api key in token
|
||||
*
|
||||
* @return bool Must return either true or false
|
||||
* @throws UnauthorizedExceptionInterface when cannot parse token
|
||||
*/
|
||||
public function __invoke(ServerRequestInterface &$request, TokenSearch $tokenSearch)
|
||||
{
|
||||
/**
|
||||
* Try find authorization token via header, parameters, cookie or attribute
|
||||
* If token not found, return response with status 401 (unauthorized)
|
||||
*/
|
||||
$token = $tokenSearch->getToken($request);
|
||||
|
||||
/**
|
||||
* Verify if token is valid on database
|
||||
* If token isn't valid, expired or has insufficient scope must throw an UnauthorizedExceptionInterface
|
||||
*/
|
||||
$user = $this->getUserByToken($token);
|
||||
|
||||
/**
|
||||
* Set authenticated user at attributes
|
||||
*/
|
||||
$request = $request->withAttribute('authenticated_user', $user);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* JsonBodyParserMiddleware
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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\Middleware;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
/**
|
||||
* JsonBodyParserMiddleware Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Middleware
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
final class JsonBodyParserMiddleware implements MiddlewareInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Parse incoming JSON input into a native PHP format
|
||||
* Copied from Slim4 guide
|
||||
* @ref https://www.slimframework.com/docs/v4/objects/request.html#the-request-body
|
||||
*
|
||||
* @param ServerRequestInterface $request HTTP request
|
||||
* @param RequestHandlerInterface $handler Request handler
|
||||
*
|
||||
* @return ResponseInterface HTTP response
|
||||
*/
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
$contentType = $request->getHeaderLine('Content-Type');
|
||||
|
||||
if (strstr($contentType, 'application/json')) {
|
||||
$contents = json_decode(file_get_contents('php://input'), true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
$request = $request->withParsedBody($contents);
|
||||
}
|
||||
}
|
||||
|
||||
return $handler->handle($request);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesAnyType
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesAnyType
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesAnyType
|
||||
{
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesArray
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesArray
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesArray
|
||||
{
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesBoolean
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesBoolean
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesBoolean
|
||||
{
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesClass
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesClass
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesClass
|
||||
{
|
||||
|
||||
/** @var map[string,string] $mapString */
|
||||
private $mapString;
|
||||
|
||||
/** @var map[string,float] $mapNumber */
|
||||
private $mapNumber;
|
||||
|
||||
/** @var map[string,int] $mapInteger */
|
||||
private $mapInteger;
|
||||
|
||||
/** @var map[string,bool] $mapBoolean */
|
||||
private $mapBoolean;
|
||||
|
||||
/** @var map[string,int[]] $mapArrayInteger */
|
||||
private $mapArrayInteger;
|
||||
|
||||
/** @var map[string,object[]] $mapArrayAnytype */
|
||||
private $mapArrayAnytype;
|
||||
|
||||
/** @var map[string,map[string,string]] $mapMapString */
|
||||
private $mapMapString;
|
||||
|
||||
/** @var map[string,map[string,object]] $mapMapAnytype */
|
||||
private $mapMapAnytype;
|
||||
|
||||
/** @var object $anytype1 */
|
||||
private $anytype1;
|
||||
|
||||
/** @var object $anytype2 */
|
||||
private $anytype2;
|
||||
|
||||
/** @var object $anytype3 */
|
||||
private $anytype3;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesInteger
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesInteger
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesInteger
|
||||
{
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesNumber
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesNumber
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesNumber
|
||||
{
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesObject
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesObject
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesObject
|
||||
{
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesString
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesString
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class AdditionalPropertiesString
|
||||
{
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
33
samples/server/petstore/php-slim4/lib/Model/Animal.php
Normal file
33
samples/server/petstore/php-slim4/lib/Model/Animal.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Animal
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Animal
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Animal
|
||||
{
|
||||
|
||||
/** @var string $className */
|
||||
private $className;
|
||||
|
||||
/** @var string $color */
|
||||
private $color;
|
||||
}
|
36
samples/server/petstore/php-slim4/lib/Model/ApiResponse.php
Normal file
36
samples/server/petstore/php-slim4/lib/Model/ApiResponse.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* ApiResponse
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ApiResponse
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ApiResponse
|
||||
{
|
||||
|
||||
/** @var int $code */
|
||||
private $code;
|
||||
|
||||
/** @var string $type */
|
||||
private $type;
|
||||
|
||||
/** @var string $message */
|
||||
private $message;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayOfArrayOfNumberOnly
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ArrayOfArrayOfNumberOnly
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ArrayOfArrayOfNumberOnly
|
||||
{
|
||||
|
||||
/** @var float[][] $arrayArrayNumber */
|
||||
private $arrayArrayNumber;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayOfNumberOnly
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ArrayOfNumberOnly
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ArrayOfNumberOnly
|
||||
{
|
||||
|
||||
/** @var float[] $arrayNumber */
|
||||
private $arrayNumber;
|
||||
}
|
36
samples/server/petstore/php-slim4/lib/Model/ArrayTest.php
Normal file
36
samples/server/petstore/php-slim4/lib/Model/ArrayTest.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ArrayTest
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ArrayTest
|
||||
{
|
||||
|
||||
/** @var string[] $arrayOfString */
|
||||
private $arrayOfString;
|
||||
|
||||
/** @var int[][] $arrayArrayOfInteger */
|
||||
private $arrayArrayOfInteger;
|
||||
|
||||
/** @var \OpenAPIServer\Model\ReadOnlyFirst[][] $arrayArrayOfModel */
|
||||
private $arrayArrayOfModel;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Capitalization
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Capitalization
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
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;
|
||||
}
|
36
samples/server/petstore/php-slim4/lib/Model/Cat.php
Normal file
36
samples/server/petstore/php-slim4/lib/Model/Cat.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Cat
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Cat
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Cat
|
||||
{
|
||||
|
||||
/** @var string $className */
|
||||
private $className;
|
||||
|
||||
/** @var string $color */
|
||||
private $color;
|
||||
|
||||
/** @var bool $declawed */
|
||||
private $declawed;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/CatAllOf.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/CatAllOf.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* CatAllOf
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* CatAllOf
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class CatAllOf
|
||||
{
|
||||
|
||||
/** @var bool $declawed */
|
||||
private $declawed;
|
||||
}
|
33
samples/server/petstore/php-slim4/lib/Model/Category.php
Normal file
33
samples/server/petstore/php-slim4/lib/Model/Category.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Category
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Category
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Category
|
||||
{
|
||||
|
||||
/** @var int $id */
|
||||
private $id;
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/ClassModel.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/ClassModel.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* ClassModel
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ClassModel
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ClassModel
|
||||
{
|
||||
|
||||
/** @var string $class */
|
||||
private $class;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/Client.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/Client.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Client
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Client
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Client
|
||||
{
|
||||
|
||||
/** @var string $client */
|
||||
private $client;
|
||||
}
|
36
samples/server/petstore/php-slim4/lib/Model/Dog.php
Normal file
36
samples/server/petstore/php-slim4/lib/Model/Dog.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Dog
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Dog
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Dog
|
||||
{
|
||||
|
||||
/** @var string $className */
|
||||
private $className;
|
||||
|
||||
/** @var string $color */
|
||||
private $color;
|
||||
|
||||
/** @var string $breed */
|
||||
private $breed;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/DogAllOf.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/DogAllOf.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* DogAllOf
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* DogAllOf
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class DogAllOf
|
||||
{
|
||||
|
||||
/** @var string $breed */
|
||||
private $breed;
|
||||
}
|
33
samples/server/petstore/php-slim4/lib/Model/EnumArrays.php
Normal file
33
samples/server/petstore/php-slim4/lib/Model/EnumArrays.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumArrays
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* EnumArrays
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class EnumArrays
|
||||
{
|
||||
|
||||
/** @var string $justSymbol */
|
||||
private $justSymbol;
|
||||
|
||||
/** @var string[] $arrayEnum */
|
||||
private $arrayEnum;
|
||||
}
|
27
samples/server/petstore/php-slim4/lib/Model/EnumClass.php
Normal file
27
samples/server/petstore/php-slim4/lib/Model/EnumClass.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumClass
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* EnumClass
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class EnumClass
|
||||
{
|
||||
}
|
42
samples/server/petstore/php-slim4/lib/Model/EnumTest.php
Normal file
42
samples/server/petstore/php-slim4/lib/Model/EnumTest.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* EnumTest
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
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;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/File.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/File.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* File
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* File
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class File
|
||||
{
|
||||
|
||||
/** @var string $sourceURI Test capitalization*/
|
||||
private $sourceURI;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* FileSchemaTestClass
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* FileSchemaTestClass
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class FileSchemaTestClass
|
||||
{
|
||||
|
||||
/** @var \OpenAPIServer\Model\File $file */
|
||||
private $file;
|
||||
|
||||
/** @var \OpenAPIServer\Model\File[] $files */
|
||||
private $files;
|
||||
}
|
69
samples/server/petstore/php-slim4/lib/Model/FormatTest.php
Normal file
69
samples/server/petstore/php-slim4/lib/Model/FormatTest.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* FormatTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* FormatTest
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
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;
|
||||
|
||||
/** @var BigDecimal $bigDecimal */
|
||||
private $bigDecimal;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* HasOnlyReadOnly
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* HasOnlyReadOnly
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class HasOnlyReadOnly
|
||||
{
|
||||
|
||||
/** @var string $bar */
|
||||
private $bar;
|
||||
|
||||
/** @var string $foo */
|
||||
private $foo;
|
||||
}
|
39
samples/server/petstore/php-slim4/lib/Model/MapTest.php
Normal file
39
samples/server/petstore/php-slim4/lib/Model/MapTest.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* MapTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* MapTest
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
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 map[string,bool] $indirectMap */
|
||||
private $indirectMap;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* MixedPropertiesAndAdditionalPropertiesClass
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* MixedPropertiesAndAdditionalPropertiesClass
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class MixedPropertiesAndAdditionalPropertiesClass
|
||||
{
|
||||
|
||||
/** @var string $uuid */
|
||||
private $uuid;
|
||||
|
||||
/** @var \DateTime $dateTime */
|
||||
private $dateTime;
|
||||
|
||||
/** @var map[string,\OpenAPIServer\Model\Animal] $map */
|
||||
private $map;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Model200Response
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Model200Response
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Model200Response
|
||||
{
|
||||
|
||||
/** @var int $name */
|
||||
private $name;
|
||||
|
||||
/** @var string $class */
|
||||
private $class;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/ModelList.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/ModelList.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* ModelList
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ModelList
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ModelList
|
||||
{
|
||||
|
||||
/** @var string $_123list */
|
||||
private $_123list;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/ModelReturn.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/ModelReturn.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* ModelReturn
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ModelReturn
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ModelReturn
|
||||
{
|
||||
|
||||
/** @var int $return */
|
||||
private $return;
|
||||
}
|
39
samples/server/petstore/php-slim4/lib/Model/Name.php
Normal file
39
samples/server/petstore/php-slim4/lib/Model/Name.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Name
|
||||
{
|
||||
|
||||
/** @var int $name */
|
||||
private $name;
|
||||
|
||||
/** @var int $snakeCase */
|
||||
private $snakeCase;
|
||||
|
||||
/** @var string $property */
|
||||
private $property;
|
||||
|
||||
/** @var int $_123number */
|
||||
private $_123number;
|
||||
}
|
30
samples/server/petstore/php-slim4/lib/Model/NumberOnly.php
Normal file
30
samples/server/petstore/php-slim4/lib/Model/NumberOnly.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* NumberOnly
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* NumberOnly
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class NumberOnly
|
||||
{
|
||||
|
||||
/** @var float $justNumber */
|
||||
private $justNumber;
|
||||
}
|
45
samples/server/petstore/php-slim4/lib/Model/Order.php
Normal file
45
samples/server/petstore/php-slim4/lib/Model/Order.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Order
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Order
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
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;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterComposite
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* OuterComposite
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class OuterComposite
|
||||
{
|
||||
|
||||
/** @var float $myNumber */
|
||||
private $myNumber;
|
||||
|
||||
/** @var string $myString */
|
||||
private $myString;
|
||||
|
||||
/** @var bool $myBoolean */
|
||||
private $myBoolean;
|
||||
}
|
27
samples/server/petstore/php-slim4/lib/Model/OuterEnum.php
Normal file
27
samples/server/petstore/php-slim4/lib/Model/OuterEnum.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterEnum
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* OuterEnum
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class OuterEnum
|
||||
{
|
||||
}
|
45
samples/server/petstore/php-slim4/lib/Model/Pet.php
Normal file
45
samples/server/petstore/php-slim4/lib/Model/Pet.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Pet
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Pet
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
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;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* ReadOnlyFirst
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* ReadOnlyFirst
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class ReadOnlyFirst
|
||||
{
|
||||
|
||||
/** @var string $bar */
|
||||
private $bar;
|
||||
|
||||
/** @var string $baz */
|
||||
private $baz;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* SpecialModelName
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* SpecialModelName
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class SpecialModelName
|
||||
{
|
||||
|
||||
/** @var int $specialPropertyName */
|
||||
private $specialPropertyName;
|
||||
}
|
33
samples/server/petstore/php-slim4/lib/Model/Tag.php
Normal file
33
samples/server/petstore/php-slim4/lib/Model/Tag.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Tag
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* Tag
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class Tag
|
||||
{
|
||||
|
||||
/** @var int $id */
|
||||
private $id;
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* TypeHolderDefault
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* TypeHolderDefault
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class TypeHolderDefault
|
||||
{
|
||||
|
||||
/** @var string $stringItem */
|
||||
private $stringItem;
|
||||
|
||||
/** @var float $numberItem */
|
||||
private $numberItem;
|
||||
|
||||
/** @var int $integerItem */
|
||||
private $integerItem;
|
||||
|
||||
/** @var bool $boolItem */
|
||||
private $boolItem;
|
||||
|
||||
/** @var int[] $arrayItem */
|
||||
private $arrayItem;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* TypeHolderExample
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* TypeHolderExample
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class TypeHolderExample
|
||||
{
|
||||
|
||||
/** @var string $stringItem */
|
||||
private $stringItem;
|
||||
|
||||
/** @var float $numberItem */
|
||||
private $numberItem;
|
||||
|
||||
/** @var float $floatItem */
|
||||
private $floatItem;
|
||||
|
||||
/** @var int $integerItem */
|
||||
private $integerItem;
|
||||
|
||||
/** @var bool $boolItem */
|
||||
private $boolItem;
|
||||
|
||||
/** @var int[] $arrayItem */
|
||||
private $arrayItem;
|
||||
}
|
51
samples/server/petstore/php-slim4/lib/Model/User.php
Normal file
51
samples/server/petstore/php-slim4/lib/Model/User.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
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;
|
||||
}
|
114
samples/server/petstore/php-slim4/lib/Model/XmlItem.php
Normal file
114
samples/server/petstore/php-slim4/lib/Model/XmlItem.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* XmlItem
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the openapi generator program.
|
||||
* https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
/**
|
||||
* XmlItem
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class XmlItem
|
||||
{
|
||||
|
||||
/** @var string $attributeString */
|
||||
private $attributeString;
|
||||
|
||||
/** @var float $attributeNumber */
|
||||
private $attributeNumber;
|
||||
|
||||
/** @var int $attributeInteger */
|
||||
private $attributeInteger;
|
||||
|
||||
/** @var bool $attributeBoolean */
|
||||
private $attributeBoolean;
|
||||
|
||||
/** @var int[] $wrappedArray */
|
||||
private $wrappedArray;
|
||||
|
||||
/** @var string $nameString */
|
||||
private $nameString;
|
||||
|
||||
/** @var float $nameNumber */
|
||||
private $nameNumber;
|
||||
|
||||
/** @var int $nameInteger */
|
||||
private $nameInteger;
|
||||
|
||||
/** @var bool $nameBoolean */
|
||||
private $nameBoolean;
|
||||
|
||||
/** @var int[] $nameArray */
|
||||
private $nameArray;
|
||||
|
||||
/** @var int[] $nameWrappedArray */
|
||||
private $nameWrappedArray;
|
||||
|
||||
/** @var string $prefixString */
|
||||
private $prefixString;
|
||||
|
||||
/** @var float $prefixNumber */
|
||||
private $prefixNumber;
|
||||
|
||||
/** @var int $prefixInteger */
|
||||
private $prefixInteger;
|
||||
|
||||
/** @var bool $prefixBoolean */
|
||||
private $prefixBoolean;
|
||||
|
||||
/** @var int[] $prefixArray */
|
||||
private $prefixArray;
|
||||
|
||||
/** @var int[] $prefixWrappedArray */
|
||||
private $prefixWrappedArray;
|
||||
|
||||
/** @var string $namespaceString */
|
||||
private $namespaceString;
|
||||
|
||||
/** @var float $namespaceNumber */
|
||||
private $namespaceNumber;
|
||||
|
||||
/** @var int $namespaceInteger */
|
||||
private $namespaceInteger;
|
||||
|
||||
/** @var bool $namespaceBoolean */
|
||||
private $namespaceBoolean;
|
||||
|
||||
/** @var int[] $namespaceArray */
|
||||
private $namespaceArray;
|
||||
|
||||
/** @var int[] $namespaceWrappedArray */
|
||||
private $namespaceWrappedArray;
|
||||
|
||||
/** @var string $prefixNsString */
|
||||
private $prefixNsString;
|
||||
|
||||
/** @var float $prefixNsNumber */
|
||||
private $prefixNsNumber;
|
||||
|
||||
/** @var int $prefixNsInteger */
|
||||
private $prefixNsInteger;
|
||||
|
||||
/** @var bool $prefixNsBoolean */
|
||||
private $prefixNsBoolean;
|
||||
|
||||
/** @var int[] $prefixNsArray */
|
||||
private $prefixNsArray;
|
||||
|
||||
/** @var int[] $prefixNsWrappedArray */
|
||||
private $prefixNsWrappedArray;
|
||||
}
|
761
samples/server/petstore/php-slim4/lib/SlimRouter.php
Normal file
761
samples/server/petstore/php-slim4/lib/SlimRouter.php
Normal file
@ -0,0 +1,761 @@
|
||||
<?php
|
||||
/**
|
||||
* SlimRouter
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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 Slim\Factory\AppFactory;
|
||||
use Slim\Interfaces\RouteInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use InvalidArgumentException;
|
||||
use Dyorg\TokenAuthentication;
|
||||
use Dyorg\TokenAuthentication\TokenSearch;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use OpenAPIServer\Middleware\JsonBodyParserMiddleware;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SlimRouter Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*/
|
||||
class SlimRouter
|
||||
{
|
||||
|
||||
/** @var App instance */
|
||||
private $slimApp;
|
||||
|
||||
/** @var array[] list of all api operations */
|
||||
private $operations = [
|
||||
[
|
||||
'httpMethod' => 'PATCH',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/another-fake/dummy',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractAnotherFakeApi',
|
||||
'userClassname' => 'AnotherFakeApi',
|
||||
'operationId' => 'call123TestSpecialTags',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/create_xml_item',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'createXmlItem',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/outer/boolean',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'fakeOuterBooleanSerialize',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/outer/composite',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'fakeOuterCompositeSerialize',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/outer/number',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'fakeOuterNumberSerialize',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/outer/string',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'fakeOuterStringSerialize',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'PUT',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/body-with-file-schema',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testBodyWithFileSchema',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'PUT',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/body-with-query-params',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testBodyWithQueryParams',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'PATCH',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testClientModel',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testEndpointParameters',
|
||||
'authMethods' => [
|
||||
// http security schema named 'http_basic_test'
|
||||
[
|
||||
'type' => 'http',
|
||||
'isBasic' => true,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testEnumParameters',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'DELETE',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testGroupParameters',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/inline-additionalProperties',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testInlineAdditionalProperties',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/jsonFormData',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testJsonFormData',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'PUT',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/test-query-paramters',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeApi',
|
||||
'userClassname' => 'FakeApi',
|
||||
'operationId' => 'testQueryParameterCollectionFormat',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'PATCH',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake_classname_test',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractFakeClassnameTags123Api',
|
||||
'userClassname' => 'FakeClassnameTags123Api',
|
||||
'operationId' => 'testClassname',
|
||||
'authMethods' => [
|
||||
// apiKey security schema named 'api_key_query'
|
||||
[
|
||||
'type' => 'apiKey',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => true,
|
||||
'isOAuth' => false,
|
||||
'keyParamName' => 'api_key_query',
|
||||
'isKeyInHeader' => false,
|
||||
'isKeyInQuery' => true,
|
||||
'isKeyInCookie' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'addPet',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet/findByStatus',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'findPetsByStatus',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet/findByTags',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'findPetsByTags',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'PUT',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'updatePet',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'DELETE',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet/{petId}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'deletePet',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet/{petId}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'getPetById',
|
||||
'authMethods' => [
|
||||
// apiKey security schema named 'api_key'
|
||||
[
|
||||
'type' => 'apiKey',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => true,
|
||||
'isOAuth' => false,
|
||||
'keyParamName' => 'api_key',
|
||||
'isKeyInHeader' => true,
|
||||
'isKeyInQuery' => false,
|
||||
'isKeyInCookie' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet/{petId}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'updatePetWithForm',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/pet/{petId}/uploadImage',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'uploadFile',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/fake/{petId}/uploadImageWithRequiredFile',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractPetApi',
|
||||
'userClassname' => 'PetApi',
|
||||
'operationId' => 'uploadFileWithRequiredFile',
|
||||
'authMethods' => [
|
||||
// oauth2 security schema named 'petstore_auth'
|
||||
[
|
||||
'type' => 'oauth2',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => false,
|
||||
'isOAuth' => true,
|
||||
'scopes' => [
|
||||
'write:pets', // modify pets in your account
|
||||
'read:pets', // read your pets
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/store/inventory',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractStoreApi',
|
||||
'userClassname' => 'StoreApi',
|
||||
'operationId' => 'getInventory',
|
||||
'authMethods' => [
|
||||
// apiKey security schema named 'api_key'
|
||||
[
|
||||
'type' => 'apiKey',
|
||||
'isBasic' => false,
|
||||
'isBearer' => false,
|
||||
'isApiKey' => true,
|
||||
'isOAuth' => false,
|
||||
'keyParamName' => 'api_key',
|
||||
'isKeyInHeader' => true,
|
||||
'isKeyInQuery' => false,
|
||||
'isKeyInCookie' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/store/order',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractStoreApi',
|
||||
'userClassname' => 'StoreApi',
|
||||
'operationId' => 'placeOrder',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'DELETE',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/store/order/{order_id}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractStoreApi',
|
||||
'userClassname' => 'StoreApi',
|
||||
'operationId' => 'deleteOrder',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/store/order/{order_id}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractStoreApi',
|
||||
'userClassname' => 'StoreApi',
|
||||
'operationId' => 'getOrderById',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'createUser',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user/createWithArray',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'createUsersWithArrayInput',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'POST',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user/createWithList',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'createUsersWithListInput',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user/login',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'loginUser',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user/logout',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'logoutUser',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'DELETE',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user/{username}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'deleteUser',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'GET',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user/{username}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'getUserByName',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
[
|
||||
'httpMethod' => 'PUT',
|
||||
'basePathWithoutHost' => '/v2',
|
||||
'path' => '/user/{username}',
|
||||
'apiPackage' => 'OpenAPIServer\Api',
|
||||
'classname' => 'AbstractUserApi',
|
||||
'userClassname' => 'UserApi',
|
||||
'operationId' => 'updateUser',
|
||||
'authMethods' => [
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings
|
||||
*
|
||||
* @throws Exception When implementation class doesn't exists
|
||||
*/
|
||||
public function __construct($settings = [])
|
||||
{
|
||||
if ($settings instanceof ContainerInterface) {
|
||||
// Set container to create App with on AppFactory
|
||||
AppFactory::setContainer($settings);
|
||||
}
|
||||
$this->slimApp = AppFactory::create();
|
||||
|
||||
// middlewares requires Psr\Container\ContainerInterface
|
||||
$container = $this->slimApp->getContainer();
|
||||
|
||||
$authPackage = 'OpenAPIServer\Auth';
|
||||
$basicAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {
|
||||
$message = "How about extending AbstractAuthenticator class by {$authPackage}\BasicAuthenticator?";
|
||||
throw new Exception($message);
|
||||
};
|
||||
$apiKeyAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {
|
||||
$message = "How about extending AbstractAuthenticator class by {$authPackage}\ApiKeyAuthenticator?";
|
||||
throw new Exception($message);
|
||||
};
|
||||
$oAuthAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {
|
||||
$message = "How about extending AbstractAuthenticator class by {$authPackage}\OAuthAuthenticator?";
|
||||
throw new Exception($message);
|
||||
};
|
||||
|
||||
$userOptions = null;
|
||||
if ($settings instanceof ContainerInterface && $settings->has('tokenAuthenticationOptions')) {
|
||||
$userOptions = $settings->get('tokenAuthenticationOptions');
|
||||
} elseif (is_array($settings) && isset($settings['tokenAuthenticationOptions'])) {
|
||||
$userOptions = $settings['tokenAuthenticationOptions'];
|
||||
}
|
||||
|
||||
foreach ($this->operations as $operation) {
|
||||
$callback = function ($request, $response, $arguments) use ($operation) {
|
||||
$message = "How about extending {$operation['classname']} by {$operation['apiPackage']}\\{$operation['userClassname']} class implementing {$operation['operationId']} as a {$operation['httpMethod']} method?";
|
||||
throw new Exception($message);
|
||||
$response->getBody()->write($message);
|
||||
return $response->withStatus(501);
|
||||
};
|
||||
$middlewares = [new JsonBodyParserMiddleware()];
|
||||
|
||||
if (class_exists("\\{$operation['apiPackage']}\\{$operation['userClassname']}")) {
|
||||
$callback = "\\{$operation['apiPackage']}\\{$operation['userClassname']}:{$operation['operationId']}";
|
||||
}
|
||||
|
||||
foreach ($operation['authMethods'] as $authMethod) {
|
||||
switch ($authMethod['type']) {
|
||||
case 'http':
|
||||
$authenticatorClassname = "\\{$authPackage}\\BasicAuthenticator";
|
||||
if (class_exists($authenticatorClassname)) {
|
||||
$basicAuthenticator = new $authenticatorClassname($container);
|
||||
}
|
||||
|
||||
$middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([
|
||||
'authenticator' => $basicAuthenticator,
|
||||
'regex' => $authMethod['isBearer'] ? '/Bearer\s+(.*)$/i' : '/Basic\s+(.*)$/i',
|
||||
'header' => 'Authorization',
|
||||
'parameter' => null,
|
||||
'cookie' => null,
|
||||
'argument' => null,
|
||||
], $userOptions));
|
||||
break;
|
||||
case 'apiKey':
|
||||
$authenticatorClassname = "\\{$authPackage}\\ApiKeyAuthenticator";
|
||||
if (class_exists($authenticatorClassname)) {
|
||||
$apiKeyAuthenticator = new $authenticatorClassname($container);
|
||||
}
|
||||
|
||||
$middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([
|
||||
'authenticator' => $apiKeyAuthenticator,
|
||||
'regex' => '/^(.*)$/i',
|
||||
'header' => $authMethod['isKeyInHeader'] ? $authMethod['keyParamName'] : null,
|
||||
'parameter' => $authMethod['isKeyInQuery'] ? $authMethod['keyParamName'] : null,
|
||||
'cookie' => $authMethod['isKeyInCookie'] ? $authMethod['keyParamName'] : null,
|
||||
'argument' => null,
|
||||
], $userOptions));
|
||||
break;
|
||||
case 'oauth2':
|
||||
$authenticatorClassname = "\\{$authPackage}\\OAuthAuthenticator";
|
||||
if (class_exists($authenticatorClassname)) {
|
||||
$oAuthAuthenticator = new $authenticatorClassname($container, $authMethod['scopes']);
|
||||
}
|
||||
|
||||
$middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([
|
||||
'authenticator' => $oAuthAuthenticator,
|
||||
'regex' => '/Bearer\s+(.*)$/i',
|
||||
'header' => 'Authorization',
|
||||
'parameter' => null,
|
||||
'cookie' => null,
|
||||
'argument' => null,
|
||||
], $userOptions));
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Unknown authorization schema type');
|
||||
}
|
||||
}
|
||||
|
||||
$this->addRoute(
|
||||
[$operation['httpMethod']],
|
||||
"{$operation['basePathWithoutHost']}{$operation['path']}",
|
||||
$callback,
|
||||
$middlewares
|
||||
)->setName($operation['operationId']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges user defined options with dynamic params
|
||||
*
|
||||
* @param array $staticOptions Required static options
|
||||
* @param array $userOptions User options
|
||||
*
|
||||
* @return array Merged array
|
||||
*/
|
||||
private function getTokenAuthenticationOptions(array $staticOptions, array $userOptions = null)
|
||||
{
|
||||
if (is_array($userOptions) === false) {
|
||||
return $staticOptions;
|
||||
}
|
||||
|
||||
return array_merge($userOptions, $staticOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add route with multiple methods
|
||||
*
|
||||
* @param string[] $methods Numeric array of HTTP method names
|
||||
* @param string $pattern The route URI pattern
|
||||
* @param callable|string $callable The route callback routine
|
||||
* @param array|null $middlewares List of middlewares
|
||||
*
|
||||
* @return RouteInterface
|
||||
*
|
||||
* @throws InvalidArgumentException If the route pattern isn't a string
|
||||
*/
|
||||
public function addRoute(array $methods, string $pattern, $callable, $middlewares = [])
|
||||
{
|
||||
$route = $this->slimApp->map($methods, $pattern, $callable);
|
||||
foreach ($middlewares as $middleware) {
|
||||
$route->add($middleware);
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Slim Framework instance
|
||||
*
|
||||
* @return App
|
||||
*/
|
||||
public function getSlimApp()
|
||||
{
|
||||
return $this->slimApp;
|
||||
}
|
||||
}
|
31
samples/server/petstore/php-slim4/phpcs.xml.dist
Normal file
31
samples/server/petstore/php-slim4/phpcs.xml.dist
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OpenAPI Petstore Config" xsi:noNamespaceSchemaLocation="phpcs.xsd">
|
||||
<description>PHP_CodeSniffer config for OpenAPI Petstore</description>
|
||||
|
||||
<!-- Path to inspected files -->
|
||||
<file>./</file>
|
||||
|
||||
<!-- Don't need to inspect installed packages -->
|
||||
<exclude-pattern>./vendor</exclude-pattern>
|
||||
|
||||
<!-- <basepath> A path to strip from the front of file paths inside reports -->
|
||||
<arg name="basepath" value="."/>
|
||||
|
||||
<!-- colors Use colors in output -->
|
||||
<arg name="colors"/>
|
||||
|
||||
<!-- Do not print warnings -->
|
||||
<!-- <arg name="warning-severity" value="0"/> -->
|
||||
|
||||
<!-- -p Show progress of the run -->
|
||||
<!-- -s Show sniff codes in all reports -->
|
||||
<arg value="ps"/>
|
||||
|
||||
<!-- Include the whole PSR12 standard -->
|
||||
<rule ref="PSR12">
|
||||
<!-- There is no way to wrap generated comments, just disable that rule for now -->
|
||||
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||
<!-- Codegen generates variables with underscore on purpose -->
|
||||
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
|
||||
</rule>
|
||||
</ruleset>
|
30
samples/server/petstore/php-slim4/phpunit.xml.dist
Normal file
30
samples/server/petstore/php-slim4/phpunit.xml.dist
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
|
||||
bootstrap="./vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
stopOnFailure="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Apis">
|
||||
<directory>./test/Api</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Models">
|
||||
<directory>./test/Model</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./lib/Api</directory>
|
||||
<directory suffix=".php">./lib/Model</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<ini name="error_reporting" value="E_ALL" />
|
||||
</php>
|
||||
</phpunit>
|
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* AnotherFakeApiTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the endpoint.
|
||||
*/
|
||||
namespace OpenAPIServer\Api;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Api\AnotherFakeApi;
|
||||
|
||||
/**
|
||||
* AnotherFakeApiTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Api\AnotherFakeApi
|
||||
*/
|
||||
class AnotherFakeApiTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for call123TestSpecialTags
|
||||
*
|
||||
* To test special tags.
|
||||
*
|
||||
* @covers ::call123TestSpecialTags
|
||||
*/
|
||||
public function testCall123TestSpecialTags()
|
||||
{
|
||||
}
|
||||
}
|
223
samples/server/petstore/php-slim4/test/Api/FakeApiTest.php
Normal file
223
samples/server/petstore/php-slim4/test/Api/FakeApiTest.php
Normal file
@ -0,0 +1,223 @@
|
||||
<?php
|
||||
/**
|
||||
* FakeApiTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the endpoint.
|
||||
*/
|
||||
namespace OpenAPIServer\Api;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Api\FakeApi;
|
||||
|
||||
/**
|
||||
* FakeApiTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Api\FakeApi
|
||||
*/
|
||||
class FakeApiTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for createXmlItem
|
||||
*
|
||||
* creates an XmlItem.
|
||||
*
|
||||
* @covers ::createXmlItem
|
||||
*/
|
||||
public function testCreateXmlItem()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for fakeOuterBooleanSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
* @covers ::fakeOuterBooleanSerialize
|
||||
*/
|
||||
public function testFakeOuterBooleanSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for fakeOuterCompositeSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
* @covers ::fakeOuterCompositeSerialize
|
||||
*/
|
||||
public function testFakeOuterCompositeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for fakeOuterNumberSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
* @covers ::fakeOuterNumberSerialize
|
||||
*/
|
||||
public function testFakeOuterNumberSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for fakeOuterStringSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
* @covers ::fakeOuterStringSerialize
|
||||
*/
|
||||
public function testFakeOuterStringSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testBodyWithFileSchema
|
||||
*
|
||||
* .
|
||||
*
|
||||
* @covers ::testBodyWithFileSchema
|
||||
*/
|
||||
public function testTestBodyWithFileSchema()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testBodyWithQueryParams
|
||||
*
|
||||
* .
|
||||
*
|
||||
* @covers ::testBodyWithQueryParams
|
||||
*/
|
||||
public function testTestBodyWithQueryParams()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testClientModel
|
||||
*
|
||||
* To test \"client\" model.
|
||||
*
|
||||
* @covers ::testClientModel
|
||||
*/
|
||||
public function testTestClientModel()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testEndpointParameters
|
||||
*
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트.
|
||||
*
|
||||
* @covers ::testEndpointParameters
|
||||
*/
|
||||
public function testTestEndpointParameters()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testEnumParameters
|
||||
*
|
||||
* To test enum parameters.
|
||||
*
|
||||
* @covers ::testEnumParameters
|
||||
*/
|
||||
public function testTestEnumParameters()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testGroupParameters
|
||||
*
|
||||
* Fake endpoint to test group parameters (optional).
|
||||
*
|
||||
* @covers ::testGroupParameters
|
||||
*/
|
||||
public function testTestGroupParameters()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testInlineAdditionalProperties
|
||||
*
|
||||
* test inline additionalProperties.
|
||||
*
|
||||
* @covers ::testInlineAdditionalProperties
|
||||
*/
|
||||
public function testTestInlineAdditionalProperties()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testJsonFormData
|
||||
*
|
||||
* test json serialization of form data.
|
||||
*
|
||||
* @covers ::testJsonFormData
|
||||
*/
|
||||
public function testTestJsonFormData()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testQueryParameterCollectionFormat
|
||||
*
|
||||
* .
|
||||
*
|
||||
* @covers ::testQueryParameterCollectionFormat
|
||||
*/
|
||||
public function testTestQueryParameterCollectionFormat()
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* FakeClassnameTags123ApiTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the endpoint.
|
||||
*/
|
||||
namespace OpenAPIServer\Api;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Api\FakeClassnameTags123Api;
|
||||
|
||||
/**
|
||||
* FakeClassnameTags123ApiTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Api\FakeClassnameTags123Api
|
||||
*/
|
||||
class FakeClassnameTags123ApiTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testClassname
|
||||
*
|
||||
* To test class name in snake case.
|
||||
*
|
||||
* @covers ::testClassname
|
||||
*/
|
||||
public function testTestClassname()
|
||||
{
|
||||
}
|
||||
}
|
168
samples/server/petstore/php-slim4/test/Api/PetApiTest.php
Normal file
168
samples/server/petstore/php-slim4/test/Api/PetApiTest.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/**
|
||||
* PetApiTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the endpoint.
|
||||
*/
|
||||
namespace OpenAPIServer\Api;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Api\PetApi;
|
||||
|
||||
/**
|
||||
* PetApiTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Api\PetApi
|
||||
*/
|
||||
class PetApiTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for addPet
|
||||
*
|
||||
* Add a new pet to the store.
|
||||
*
|
||||
* @covers ::addPet
|
||||
*/
|
||||
public function testAddPet()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for deletePet
|
||||
*
|
||||
* Deletes a pet.
|
||||
*
|
||||
* @covers ::deletePet
|
||||
*/
|
||||
public function testDeletePet()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for findPetsByStatus
|
||||
*
|
||||
* Finds Pets by status.
|
||||
*
|
||||
* @covers ::findPetsByStatus
|
||||
*/
|
||||
public function testFindPetsByStatus()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for findPetsByTags
|
||||
*
|
||||
* Finds Pets by tags.
|
||||
*
|
||||
* @covers ::findPetsByTags
|
||||
*/
|
||||
public function testFindPetsByTags()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getPetById
|
||||
*
|
||||
* Find pet by ID.
|
||||
*
|
||||
* @covers ::getPetById
|
||||
*/
|
||||
public function testGetPetById()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for updatePet
|
||||
*
|
||||
* Update an existing pet.
|
||||
*
|
||||
* @covers ::updatePet
|
||||
*/
|
||||
public function testUpdatePet()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for updatePetWithForm
|
||||
*
|
||||
* Updates a pet in the store with form data.
|
||||
*
|
||||
* @covers ::updatePetWithForm
|
||||
*/
|
||||
public function testUpdatePetWithForm()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for uploadFile
|
||||
*
|
||||
* uploads an image.
|
||||
*
|
||||
* @covers ::uploadFile
|
||||
*/
|
||||
public function testUploadFile()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for uploadFileWithRequiredFile
|
||||
*
|
||||
* uploads an image (required).
|
||||
*
|
||||
* @covers ::uploadFileWithRequiredFile
|
||||
*/
|
||||
public function testUploadFileWithRequiredFile()
|
||||
{
|
||||
}
|
||||
}
|
113
samples/server/petstore/php-slim4/test/Api/StoreApiTest.php
Normal file
113
samples/server/petstore/php-slim4/test/Api/StoreApiTest.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* StoreApiTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the endpoint.
|
||||
*/
|
||||
namespace OpenAPIServer\Api;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Api\StoreApi;
|
||||
|
||||
/**
|
||||
* StoreApiTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Api\StoreApi
|
||||
*/
|
||||
class StoreApiTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for deleteOrder
|
||||
*
|
||||
* Delete purchase order by ID.
|
||||
*
|
||||
* @covers ::deleteOrder
|
||||
*/
|
||||
public function testDeleteOrder()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getInventory
|
||||
*
|
||||
* Returns pet inventories by status.
|
||||
*
|
||||
* @covers ::getInventory
|
||||
*/
|
||||
public function testGetInventory()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getOrderById
|
||||
*
|
||||
* Find purchase order by ID.
|
||||
*
|
||||
* @covers ::getOrderById
|
||||
*/
|
||||
public function testGetOrderById()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for placeOrder
|
||||
*
|
||||
* Place an order for a pet.
|
||||
*
|
||||
* @covers ::placeOrder
|
||||
*/
|
||||
public function testPlaceOrder()
|
||||
{
|
||||
}
|
||||
}
|
157
samples/server/petstore/php-slim4/test/Api/UserApiTest.php
Normal file
157
samples/server/petstore/php-slim4/test/Api/UserApiTest.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* UserApiTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the endpoint.
|
||||
*/
|
||||
namespace OpenAPIServer\Api;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Api\UserApi;
|
||||
|
||||
/**
|
||||
* UserApiTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Api
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Api\UserApi
|
||||
*/
|
||||
class UserApiTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for createUser
|
||||
*
|
||||
* Create user.
|
||||
*
|
||||
* @covers ::createUser
|
||||
*/
|
||||
public function testCreateUser()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for createUsersWithArrayInput
|
||||
*
|
||||
* Creates list of users with given input array.
|
||||
*
|
||||
* @covers ::createUsersWithArrayInput
|
||||
*/
|
||||
public function testCreateUsersWithArrayInput()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for createUsersWithListInput
|
||||
*
|
||||
* Creates list of users with given input array.
|
||||
*
|
||||
* @covers ::createUsersWithListInput
|
||||
*/
|
||||
public function testCreateUsersWithListInput()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for deleteUser
|
||||
*
|
||||
* Delete user.
|
||||
*
|
||||
* @covers ::deleteUser
|
||||
*/
|
||||
public function testDeleteUser()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getUserByName
|
||||
*
|
||||
* Get user by user name.
|
||||
*
|
||||
* @covers ::getUserByName
|
||||
*/
|
||||
public function testGetUserByName()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for loginUser
|
||||
*
|
||||
* Logs user into the system.
|
||||
*
|
||||
* @covers ::loginUser
|
||||
*/
|
||||
public function testLoginUser()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for logoutUser
|
||||
*
|
||||
* Logs out current logged in user session.
|
||||
*
|
||||
* @covers ::logoutUser
|
||||
*/
|
||||
public function testLogoutUser()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for updateUser
|
||||
*
|
||||
* Updated user.
|
||||
*
|
||||
* @covers ::updateUser
|
||||
*/
|
||||
public function testUpdateUser()
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesAnyTypeTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Model\AdditionalPropertiesAnyType;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesAnyTypeTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Model\AdditionalPropertiesAnyType
|
||||
*/
|
||||
class AdditionalPropertiesAnyTypeTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "AdditionalPropertiesAnyType"
|
||||
*/
|
||||
public function testAdditionalPropertiesAnyType()
|
||||
{
|
||||
$testAdditionalPropertiesAnyType = new AdditionalPropertiesAnyType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "name"
|
||||
*/
|
||||
public function testPropertyName()
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesArrayTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Model\AdditionalPropertiesArray;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesArrayTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Model\AdditionalPropertiesArray
|
||||
*/
|
||||
class AdditionalPropertiesArrayTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "AdditionalPropertiesArray"
|
||||
*/
|
||||
public function testAdditionalPropertiesArray()
|
||||
{
|
||||
$testAdditionalPropertiesArray = new AdditionalPropertiesArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "name"
|
||||
*/
|
||||
public function testPropertyName()
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesBooleanTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Model\AdditionalPropertiesBoolean;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesBooleanTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Model\AdditionalPropertiesBoolean
|
||||
*/
|
||||
class AdditionalPropertiesBooleanTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "AdditionalPropertiesBoolean"
|
||||
*/
|
||||
public function testAdditionalPropertiesBoolean()
|
||||
{
|
||||
$testAdditionalPropertiesBoolean = new AdditionalPropertiesBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "name"
|
||||
*/
|
||||
public function testPropertyName()
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesClassTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Model\AdditionalPropertiesClass;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesClassTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Model\AdditionalPropertiesClass
|
||||
*/
|
||||
class AdditionalPropertiesClassTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "AdditionalPropertiesClass"
|
||||
*/
|
||||
public function testAdditionalPropertiesClass()
|
||||
{
|
||||
$testAdditionalPropertiesClass = new AdditionalPropertiesClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapString"
|
||||
*/
|
||||
public function testPropertyMapString()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapNumber"
|
||||
*/
|
||||
public function testPropertyMapNumber()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapInteger"
|
||||
*/
|
||||
public function testPropertyMapInteger()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapBoolean"
|
||||
*/
|
||||
public function testPropertyMapBoolean()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapArrayInteger"
|
||||
*/
|
||||
public function testPropertyMapArrayInteger()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapArrayAnytype"
|
||||
*/
|
||||
public function testPropertyMapArrayAnytype()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapMapString"
|
||||
*/
|
||||
public function testPropertyMapMapString()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "mapMapAnytype"
|
||||
*/
|
||||
public function testPropertyMapMapAnytype()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "anytype1"
|
||||
*/
|
||||
public function testPropertyAnytype1()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "anytype2"
|
||||
*/
|
||||
public function testPropertyAnytype2()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "anytype3"
|
||||
*/
|
||||
public function testPropertyAnytype3()
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesIntegerTest
|
||||
*
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @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: \" \\
|
||||
* The version of the OpenAPI document: 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
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use OpenAPIServer\Model\AdditionalPropertiesInteger;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesIntegerTest Class Doc Comment
|
||||
*
|
||||
* @package OpenAPIServer\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://github.com/openapitools/openapi-generator
|
||||
*
|
||||
* @coversDefaultClass \OpenAPIServer\Model\AdditionalPropertiesInteger
|
||||
*/
|
||||
class AdditionalPropertiesIntegerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test cases
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "AdditionalPropertiesInteger"
|
||||
*/
|
||||
public function testAdditionalPropertiesInteger()
|
||||
{
|
||||
$testAdditionalPropertiesInteger = new AdditionalPropertiesInteger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "name"
|
||||
*/
|
||||
public function testPropertyName()
|
||||
{
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user