forked from loafle/openapi-generator-original
[Slim4] Add ref support to Data Mocker (#4932)
* [Slim4] Add new method to Mocker interface * [Slim4] Add implementation and tests for new method * [Slim4] Add test fixture to encrease code coverage * [Slim4] Add ref support to mockArray method * [Slim4] Add mockFromRef method * [Slim4] Add ref support to mockObject method * [Slim4] Add ModelInterface * [Slim4] Refresh samples * [Slim4] Add ref support to mockFromSchema method * [Slim4] Run all test suites by default test command As it turnes out to generate coverage report for a whole project I need to run all test suites at once. * [Slim4] Fix enum option of string mocking
This commit is contained in:
committed by
William Cheng
parent
2d24d42e65
commit
6dcdf5c311
@@ -44,6 +44,8 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
|
|||||||
protected String mockPackage = "";
|
protected String mockPackage = "";
|
||||||
protected String utilsDirName = "Utils";
|
protected String utilsDirName = "Utils";
|
||||||
protected String utilsPackage = "";
|
protected String utilsPackage = "";
|
||||||
|
protected String interfacesDirName = "Interfaces";
|
||||||
|
protected String interfacesPackage = "";
|
||||||
|
|
||||||
public PhpSlim4ServerCodegen() {
|
public PhpSlim4ServerCodegen() {
|
||||||
super();
|
super();
|
||||||
@@ -54,6 +56,7 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
|
|||||||
|
|
||||||
mockPackage = invokerPackage + "\\" + mockDirName;
|
mockPackage = invokerPackage + "\\" + mockDirName;
|
||||||
utilsPackage = invokerPackage + "\\" + utilsDirName;
|
utilsPackage = invokerPackage + "\\" + utilsDirName;
|
||||||
|
interfacesPackage = invokerPackage + "\\" + interfacesDirName;
|
||||||
outputFolder = "generated-code" + File.separator + "slim4";
|
outputFolder = "generated-code" + File.separator + "slim4";
|
||||||
embeddedTemplateDir = templateDir = "php-slim4-server";
|
embeddedTemplateDir = templateDir = "php-slim4-server";
|
||||||
|
|
||||||
@@ -92,6 +95,7 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
|
|||||||
// Update mockPackage and utilsPackage
|
// Update mockPackage and utilsPackage
|
||||||
mockPackage = invokerPackage + "\\" + mockDirName;
|
mockPackage = invokerPackage + "\\" + mockDirName;
|
||||||
utilsPackage = invokerPackage + "\\" + utilsDirName;
|
utilsPackage = invokerPackage + "\\" + utilsDirName;
|
||||||
|
interfacesPackage = invokerPackage + "\\" + interfacesDirName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make mock src path available in mustache template
|
// make mock src path available in mustache template
|
||||||
@@ -104,6 +108,11 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
|
|||||||
additionalProperties.put("utilsSrcPath", "./" + toSrcPath(utilsPackage, srcBasePath));
|
additionalProperties.put("utilsSrcPath", "./" + toSrcPath(utilsPackage, srcBasePath));
|
||||||
additionalProperties.put("utilsTestPath", "./" + toSrcPath(utilsPackage, testBasePath));
|
additionalProperties.put("utilsTestPath", "./" + toSrcPath(utilsPackage, testBasePath));
|
||||||
|
|
||||||
|
// same for interfaces package
|
||||||
|
additionalProperties.put("interfacesPackage", interfacesPackage);
|
||||||
|
additionalProperties.put("interfacesSrcPath", "./" + toSrcPath(interfacesPackage, srcBasePath));
|
||||||
|
additionalProperties.put("interfacesTestPath", "./" + toSrcPath(interfacesPackage, testBasePath));
|
||||||
|
|
||||||
if (additionalProperties.containsKey(PSR7_IMPLEMENTATION)) {
|
if (additionalProperties.containsKey(PSR7_IMPLEMENTATION)) {
|
||||||
this.setPsr7Implementation((String) additionalProperties.get(PSR7_IMPLEMENTATION));
|
this.setPsr7Implementation((String) additionalProperties.get(PSR7_IMPLEMENTATION));
|
||||||
}
|
}
|
||||||
@@ -147,6 +156,9 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
|
|||||||
supportingFiles.add(new SupportingFile("string_utils_trait_test.mustache", toSrcPath(utilsPackage, testBasePath), toTraitName("StringUtils") + "Test.php"));
|
supportingFiles.add(new SupportingFile("string_utils_trait_test.mustache", toSrcPath(utilsPackage, testBasePath), toTraitName("StringUtils") + "Test.php"));
|
||||||
supportingFiles.add(new SupportingFile("model_utils_trait.mustache", toSrcPath(utilsPackage, srcBasePath), toTraitName("ModelUtils") + ".php"));
|
supportingFiles.add(new SupportingFile("model_utils_trait.mustache", toSrcPath(utilsPackage, srcBasePath), toTraitName("ModelUtils") + ".php"));
|
||||||
supportingFiles.add(new SupportingFile("model_utils_trait_test.mustache", toSrcPath(utilsPackage, testBasePath), toTraitName("ModelUtils") + "Test.php"));
|
supportingFiles.add(new SupportingFile("model_utils_trait_test.mustache", toSrcPath(utilsPackage, testBasePath), toTraitName("ModelUtils") + "Test.php"));
|
||||||
|
|
||||||
|
// model interface
|
||||||
|
supportingFiles.add(new SupportingFile("model_interface.mustache", toSrcPath(interfacesPackage, srcBasePath), toInterfaceName("Model") + ".php"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -41,10 +41,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": [
|
"test": [
|
||||||
"@test-apis",
|
"phpunit"
|
||||||
"@test-models",
|
|
||||||
"@test-mock",
|
|
||||||
"@test-utils"
|
|
||||||
],
|
],
|
||||||
"test-apis": "phpunit --testsuite Apis",
|
"test-apis": "phpunit --testsuite Apis",
|
||||||
"test-models": "phpunit --testsuite Models",
|
"test-models": "phpunit --testsuite Models",
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace {{modelPackage}};
|
namespace {{modelPackage}};
|
||||||
|
|
||||||
|
use {{interfacesPackage}}\{{interfaceNamePrefix}}Model{{interfaceNameSuffix}};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {{classname}}
|
* {{classname}}
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,27 @@ namespace {{modelPackage}};
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class {{classname}}
|
class {{classname}} implements {{interfaceNamePrefix}}Model{{interfaceNameSuffix}}
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{{{modelJson}}}
|
||||||
|
SCHEMA;
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
|
|
||||||
/** @var {{dataType}} ${{name}} {{#description}}{{description}}{{/description}}*/
|
/** @var {{dataType}} ${{name}} {{#description}}{{description}}{{/description}}*/
|
||||||
private ${{name}};
|
private ${{name}};
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{{/model}}{{/models}}
|
{{/model}}{{/models}}
|
||||||
54
modules/openapi-generator/src/main/resources/php-slim4-server/model_interface.mustache
vendored
Normal file
54
modules/openapi-generator/src/main/resources/php-slim4-server/model_interface.mustache
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {{interfaceNamePrefix}}Model{{interfaceNameSuffix}}
|
||||||
|
*
|
||||||
|
* 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 {{interfacesPackage}};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {{interfaceNamePrefix}}Model{{interfaceNameSuffix}} Class Doc Comment
|
||||||
|
*
|
||||||
|
* @package {{interfacesPackage}}
|
||||||
|
* @author OpenAPI Generator team
|
||||||
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
|
*/
|
||||||
|
interface {{interfaceNamePrefix}}Model{{interfaceNameSuffix}}
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false);
|
||||||
|
}
|
||||||
|
{{/apiInfo}}
|
||||||
@@ -95,5 +95,17 @@ class {{classname}}Test extends TestCase
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test getOpenApiSchema static method
|
||||||
|
* @covers ::getOpenApiSchema
|
||||||
|
*/
|
||||||
|
public function testGetOpenApiSchema()
|
||||||
|
{
|
||||||
|
$schemaObject = {{classname}}::getOpenApiSchema();
|
||||||
|
$schemaArr = {{classname}}::getOpenApiSchema(true);
|
||||||
|
$this->assertIsObject($schemaObject);
|
||||||
|
$this->assertIsArray($schemaArr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{{/model}}{{/models}}
|
{{/model}}{{/models}}
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
namespace {{mockPackage}};
|
namespace {{mockPackage}};
|
||||||
|
|
||||||
use {{mockPackage}}\{{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}} as IMocker;
|
use {{mockPackage}}\{{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}} as IMocker;
|
||||||
|
use {{utilsPackage}}\{{traitNamePrefix}}ModelUtils{{traitNameSuffix}};
|
||||||
use StdClass;
|
use StdClass;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
@@ -46,6 +47,8 @@ use InvalidArgumentException;
|
|||||||
*/
|
*/
|
||||||
final class OpenApiDataMocker implements IMocker
|
final class OpenApiDataMocker implements IMocker
|
||||||
{
|
{
|
||||||
|
use {{traitNamePrefix}}ModelUtils{{traitNameSuffix}};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mocks OpenApi Data.
|
* Mocks OpenApi Data.
|
||||||
* @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types
|
* @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types
|
||||||
@@ -74,7 +77,8 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
case IMocker::DATA_TYPE_STRING:
|
case IMocker::DATA_TYPE_STRING:
|
||||||
$minLength = $options['minLength'] ?? 0;
|
$minLength = $options['minLength'] ?? 0;
|
||||||
$maxLength = $options['maxLength'] ?? null;
|
$maxLength = $options['maxLength'] ?? null;
|
||||||
return $this->mockString($dataFormat, $minLength, $maxLength);
|
$enum = $options['enum'] ?? null;
|
||||||
|
return $this->mockString($dataFormat, $minLength, $maxLength, $enum);
|
||||||
case IMocker::DATA_TYPE_BOOLEAN:
|
case IMocker::DATA_TYPE_BOOLEAN:
|
||||||
return $this->mockBoolean();
|
return $this->mockBoolean();
|
||||||
case IMocker::DATA_TYPE_ARRAY:
|
case IMocker::DATA_TYPE_ARRAY:
|
||||||
@@ -276,11 +280,13 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
$options = $this->extractSchemaProperties($items);
|
$options = $this->extractSchemaProperties($items);
|
||||||
$dataType = $options['type'];
|
$dataType = $options['type'];
|
||||||
$dataFormat = $options['format'] ?? null;
|
$dataFormat = $options['format'] ?? null;
|
||||||
|
$ref = $options['$ref'] ?? null;
|
||||||
|
|
||||||
// always genarate smallest possible array to avoid huge JSON responses
|
// always generate smallest possible array to avoid huge JSON responses
|
||||||
$arrSize = ($maxSize < 1) ? $maxSize : max($minSize, 1);
|
$arrSize = ($maxSize < 1) ? $maxSize : max($minSize, 1);
|
||||||
while (count($arr) < $arrSize) {
|
while (count($arr) < $arrSize) {
|
||||||
$arr[] = $this->mock($dataType, $dataFormat, $options);
|
$data = $this->mockFromRef($ref);
|
||||||
|
$arr[] = ($data) ? $data : $this->mock($dataType, $dataFormat, $options);
|
||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
@@ -360,12 +366,62 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
$options = $this->extractSchemaProperties($propValue);
|
$options = $this->extractSchemaProperties($propValue);
|
||||||
$dataType = $options['type'];
|
$dataType = $options['type'];
|
||||||
$dataFormat = $options['dataFormat'] ?? null;
|
$dataFormat = $options['dataFormat'] ?? null;
|
||||||
$obj->$propName = $this->mock($dataType, $dataFormat, $options);
|
$ref = $options['$ref'] ?? null;
|
||||||
|
$data = $this->mockFromRef($ref);
|
||||||
|
$obj->$propName = ($data) ? $data : $this->mock($dataType, $dataFormat, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mocks OpenApi Data from schema.
|
||||||
|
*
|
||||||
|
* @param array|object $schema OpenAPI schema
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException when invalid arguments passed
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromSchema($schema)
|
||||||
|
{
|
||||||
|
$props = $this->extractSchemaProperties($schema);
|
||||||
|
if (array_key_exists('$ref', $props) && !empty($props['$ref'])) {
|
||||||
|
return $this->mockFromRef($props['$ref']);
|
||||||
|
} elseif ($props['type'] === null) {
|
||||||
|
throw new InvalidArgumentException('"schema" must be object or assoc array with "type" property');
|
||||||
|
}
|
||||||
|
return $this->mock($props['type'], $props['format'], $props);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mock data by referenced schema.
|
||||||
|
* TODO: this method will return model instance, not an StdClass
|
||||||
|
*
|
||||||
|
* @param string|null $ref Ref to model, eg. #/components/schemas/User
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromRef($ref)
|
||||||
|
{
|
||||||
|
$data = null;
|
||||||
|
if (is_string($ref) && !empty($ref)) {
|
||||||
|
$refName = static::getSimpleRef($ref);
|
||||||
|
$modelName = static::toModelName($refName);
|
||||||
|
$modelClass = '{{modelPackage}}\\' . $modelName;
|
||||||
|
if (!class_exists($modelClass) || !method_exists($modelClass, 'getOpenApiSchema')) {
|
||||||
|
throw new InvalidArgumentException(sprintf(
|
||||||
|
'Model %s not found or method %s doesn\'t exist',
|
||||||
|
$modelClass,
|
||||||
|
$modelClass . '::getOpenApiSchema'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$data = $this->mockFromSchema($modelClass::getOpenApiSchema(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal Extract OAS properties from array or object.
|
* @internal Extract OAS properties from array or object.
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -402,6 +458,7 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
'additionalProperties',
|
'additionalProperties',
|
||||||
'required',
|
'required',
|
||||||
'example',
|
'example',
|
||||||
|
'$ref',
|
||||||
] as $propName
|
] as $propName
|
||||||
) {
|
) {
|
||||||
if (is_array($val) && array_key_exists($propName, $val)) {
|
if (is_array($val) && array_key_exists($propName, $val)) {
|
||||||
|
|||||||
@@ -237,5 +237,28 @@ interface {{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}}
|
|||||||
$additionalProperties = null,
|
$additionalProperties = null,
|
||||||
$required = null
|
$required = null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mocks OpenApi Data from schema.
|
||||||
|
*
|
||||||
|
* @param array|object $schema OpenAPI schema
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException when invalid arguments passed
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromSchema($schema);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mock data by referenced schema.
|
||||||
|
* TODO: this method will return model instance, not an StdClass
|
||||||
|
*
|
||||||
|
* @param string|null $ref Ref to model, eg. #/components/schemas/User
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException when invalid arguments passed
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromRef($ref);
|
||||||
}
|
}
|
||||||
{{/apiInfo}}
|
{{/apiInfo}}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ use {{mockPackage}}\{{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffi
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use PHPUnit\Framework\Constraint\IsType;
|
use PHPUnit\Framework\Constraint\IsType;
|
||||||
use StdClass;
|
use StdClass;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OpenApiDataMockerTest Class Doc Comment
|
* OpenApiDataMockerTest Class Doc Comment
|
||||||
@@ -103,6 +104,18 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::mock
|
||||||
|
*/
|
||||||
|
public function testMockWithStringEnumOptions()
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$string = $mocker->mock(IMocker::DATA_TYPE_STRING, null, [
|
||||||
|
'enum' => ['foobar', 'foobaz', 'helloworld'],
|
||||||
|
]);
|
||||||
|
$this->assertContains($string, ['foobar', 'foobaz', 'helloworld']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideMockIntegerCorrectArguments
|
* @dataProvider provideMockIntegerCorrectArguments
|
||||||
* @covers ::mockInteger
|
* @covers ::mockInteger
|
||||||
@@ -647,6 +660,45 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
'maxItems less than minItems' => [
|
'maxItems less than minItems' => [
|
||||||
$intItems, 5, 2, false,
|
$intItems, 5, 2, false,
|
||||||
],
|
],
|
||||||
|
'items with ref to unknown class' => [
|
||||||
|
['$ref' => '#/components/schemas/UnknownClass'], null, null, false,
|
||||||
|
],
|
||||||
|
'items with ref to class without getOpenApiSchema method' => [
|
||||||
|
['$ref' => '#/components/schemas/ClassWithoutGetSchemaMethod'], null, null, false,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockArrayWithRefArguments
|
||||||
|
* @covers ::mockArray
|
||||||
|
*/
|
||||||
|
public function testMockArrayWithRef($items, $expectedStructure)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$arr = $mocker->mockArray($items);
|
||||||
|
$this->assertIsArray($arr);
|
||||||
|
$this->assertCount(1, $arr);
|
||||||
|
foreach ($arr as $item) {
|
||||||
|
// TODO: replace with assertInstanceOf assertion
|
||||||
|
$this->assertInternalType(IsType::TYPE_OBJECT, $item);
|
||||||
|
foreach ($expectedStructure as $expectedProp => $expectedType) {
|
||||||
|
$this->assertInternalType($expectedType, $item->$expectedProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockArrayWithRefArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'items with ref to CatRefTestClass' => [
|
||||||
|
['$ref' => '#/components/schemas/CatRefTestClass'],
|
||||||
|
[
|
||||||
|
'className' => IsType::TYPE_STRING,
|
||||||
|
'color' => IsType::TYPE_STRING,
|
||||||
|
'declawed' => IsType::TYPE_BOOL,
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,6 +783,9 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
'properties cannot be a string' => [
|
'properties cannot be a string' => [
|
||||||
'foobar', 0, 10, false, null,
|
'foobar', 0, 10, false, null,
|
||||||
],
|
],
|
||||||
|
'property value cannot be a string' => [
|
||||||
|
['username' => 'foobar'], 0, 10, false, null,
|
||||||
|
],
|
||||||
'minProperties is not integer' => [
|
'minProperties is not integer' => [
|
||||||
[], 3.12, null, false, null,
|
[], 3.12, null, false, null,
|
||||||
],
|
],
|
||||||
@@ -769,5 +824,220 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::mockObject
|
||||||
|
*/
|
||||||
|
public function testMockObjectWithReferencedProps()
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$obj = $mocker->mockObject(
|
||||||
|
(object) [
|
||||||
|
'cat' => [
|
||||||
|
'$ref' => '#/components/schemas/CatRefTestClass',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->assertInternalType(IsType::TYPE_OBJECT, $obj->cat);
|
||||||
|
$this->assertInternalType(IsType::TYPE_STRING, $obj->cat->className);
|
||||||
|
$this->assertInternalType(IsType::TYPE_STRING, $obj->cat->color);
|
||||||
|
$this->assertInternalType(IsType::TYPE_BOOL, $obj->cat->declawed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromSchemaCorrectArguments
|
||||||
|
* @covers ::mockFromSchema
|
||||||
|
*/
|
||||||
|
public function testMockFromSchemaWithCorrectArguments($schema, $expectedType)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromSchema($schema);
|
||||||
|
$this->assertInternalType($expectedType, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockFromSchemaCorrectArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'string from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'string from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'integer from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_INTEGER],
|
||||||
|
IsType::TYPE_INT,
|
||||||
|
],
|
||||||
|
'integer from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_INTEGER],
|
||||||
|
IsType::TYPE_INT,
|
||||||
|
],
|
||||||
|
'number from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_NUMBER],
|
||||||
|
IsType::TYPE_FLOAT,
|
||||||
|
],
|
||||||
|
'number from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_NUMBER],
|
||||||
|
IsType::TYPE_FLOAT,
|
||||||
|
],
|
||||||
|
'string from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'string from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'boolean from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_BOOLEAN],
|
||||||
|
IsType::TYPE_BOOL,
|
||||||
|
],
|
||||||
|
'boolean from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_BOOLEAN],
|
||||||
|
IsType::TYPE_BOOL,
|
||||||
|
],
|
||||||
|
'array of strings from object' => [
|
||||||
|
(object) [
|
||||||
|
'type' => IMocker::DATA_TYPE_ARRAY,
|
||||||
|
'items' => ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
],
|
||||||
|
IsType::TYPE_ARRAY,
|
||||||
|
],
|
||||||
|
'array of strings from array' => [
|
||||||
|
[
|
||||||
|
'type' => IMocker::DATA_TYPE_ARRAY,
|
||||||
|
'items' => ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
],
|
||||||
|
IsType::TYPE_ARRAY,
|
||||||
|
],
|
||||||
|
'object with username prop from object' => [
|
||||||
|
(object) [
|
||||||
|
'type' => IMocker::DATA_TYPE_OBJECT,
|
||||||
|
'properties' => ['username' => ['type' => IMocker::DATA_TYPE_STRING]],
|
||||||
|
],
|
||||||
|
IsType::TYPE_OBJECT,
|
||||||
|
],
|
||||||
|
'object with username prop from array' => [
|
||||||
|
[
|
||||||
|
'type' => IMocker::DATA_TYPE_OBJECT,
|
||||||
|
'properties' => ['username' => ['type' => IMocker::DATA_TYPE_STRING]],
|
||||||
|
],
|
||||||
|
IsType::TYPE_OBJECT,
|
||||||
|
],
|
||||||
|
'referenced class' => [
|
||||||
|
['$ref' => '#/components/schemas/CatRefTestClass'],
|
||||||
|
IsType::TYPE_OBJECT,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromSchemaInvalidArguments
|
||||||
|
* @expectedException \InvalidArgumentException
|
||||||
|
* @covers ::mockFromSchema
|
||||||
|
*/
|
||||||
|
public function testMockFromSchemaWithInvalidArguments($schema)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromSchema($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function provideMockFromSchemaInvalidArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'null' => [null],
|
||||||
|
'numeric' => [3.14],
|
||||||
|
'empty array' => [[]],
|
||||||
|
'empty object' => [(object) []],
|
||||||
|
'string' => ['foobar'],
|
||||||
|
'DateTime object' => [new DateTime()],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromRefCorrectArguments
|
||||||
|
* @covers ::mockFromRef
|
||||||
|
*/
|
||||||
|
public function testMockFromRefWithCorrectArguments($ref, $expectedStructure)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromRef($ref);
|
||||||
|
foreach ($expectedStructure as $expectedProp => $expectedType) {
|
||||||
|
$this->assertInternalType($expectedType, $data->$expectedProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockFromRefCorrectArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'CatRefTestClass model' => [
|
||||||
|
'#/components/schemas/CatRefTestClass',
|
||||||
|
[
|
||||||
|
'className' => IsType::TYPE_STRING,
|
||||||
|
'color' => IsType::TYPE_STRING,
|
||||||
|
'declawed' => IsType::TYPE_BOOL,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromRefInvalidArguments
|
||||||
|
* @expectedException \InvalidArgumentException
|
||||||
|
* @covers ::mockFromRef
|
||||||
|
*/
|
||||||
|
public function testMockFromRefWithInvalidArguments($ref)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromRef($ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockFromRefInvalidArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'ref to unknown class' => ['#/components/schemas/UnknownClass'],
|
||||||
|
'ref to class without getOpenApiSchema method' => ['#/components/schemas/ClassWithoutGetSchemaMethod'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace {{modelPackage}};
|
||||||
|
|
||||||
|
// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
|
||||||
|
final class CatRefTestClass
|
||||||
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "className" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"className" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"color" : {
|
||||||
|
"type" : "string",
|
||||||
|
"default" : "red"
|
||||||
|
},
|
||||||
|
"declawed" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"discriminator" : {
|
||||||
|
"propertyName" : "className"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
|
public static function getOpenApiSchema()
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final class ClassWithoutGetSchemaMethod
|
||||||
|
{
|
||||||
}
|
}
|
||||||
{{/apiInfo}}
|
{{/apiInfo}}
|
||||||
|
|||||||
@@ -28,10 +28,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": [
|
"test": [
|
||||||
"@test-apis",
|
"phpunit"
|
||||||
"@test-models",
|
|
||||||
"@test-mock",
|
|
||||||
"@test-utils"
|
|
||||||
],
|
],
|
||||||
"test-apis": "phpunit --testsuite Apis",
|
"test-apis": "phpunit --testsuite Apis",
|
||||||
"test-models": "phpunit --testsuite Models",
|
"test-models": "phpunit --testsuite Models",
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ModelInterface
|
||||||
|
*
|
||||||
|
* 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\Interfaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ModelInterface Class Doc Comment
|
||||||
|
*
|
||||||
|
* @package OpenAPIServer\Interfaces
|
||||||
|
* @author OpenAPI Generator team
|
||||||
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
|
*/
|
||||||
|
interface ModelInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false);
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
namespace OpenAPIServer\Mock;
|
namespace OpenAPIServer\Mock;
|
||||||
|
|
||||||
use OpenAPIServer\Mock\OpenApiDataMockerInterface as IMocker;
|
use OpenAPIServer\Mock\OpenApiDataMockerInterface as IMocker;
|
||||||
|
use OpenAPIServer\Utils\ModelUtilsTrait;
|
||||||
use StdClass;
|
use StdClass;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
@@ -38,6 +39,8 @@ use InvalidArgumentException;
|
|||||||
*/
|
*/
|
||||||
final class OpenApiDataMocker implements IMocker
|
final class OpenApiDataMocker implements IMocker
|
||||||
{
|
{
|
||||||
|
use ModelUtilsTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mocks OpenApi Data.
|
* Mocks OpenApi Data.
|
||||||
* @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types
|
* @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types
|
||||||
@@ -66,7 +69,8 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
case IMocker::DATA_TYPE_STRING:
|
case IMocker::DATA_TYPE_STRING:
|
||||||
$minLength = $options['minLength'] ?? 0;
|
$minLength = $options['minLength'] ?? 0;
|
||||||
$maxLength = $options['maxLength'] ?? null;
|
$maxLength = $options['maxLength'] ?? null;
|
||||||
return $this->mockString($dataFormat, $minLength, $maxLength);
|
$enum = $options['enum'] ?? null;
|
||||||
|
return $this->mockString($dataFormat, $minLength, $maxLength, $enum);
|
||||||
case IMocker::DATA_TYPE_BOOLEAN:
|
case IMocker::DATA_TYPE_BOOLEAN:
|
||||||
return $this->mockBoolean();
|
return $this->mockBoolean();
|
||||||
case IMocker::DATA_TYPE_ARRAY:
|
case IMocker::DATA_TYPE_ARRAY:
|
||||||
@@ -268,11 +272,13 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
$options = $this->extractSchemaProperties($items);
|
$options = $this->extractSchemaProperties($items);
|
||||||
$dataType = $options['type'];
|
$dataType = $options['type'];
|
||||||
$dataFormat = $options['format'] ?? null;
|
$dataFormat = $options['format'] ?? null;
|
||||||
|
$ref = $options['$ref'] ?? null;
|
||||||
|
|
||||||
// always genarate smallest possible array to avoid huge JSON responses
|
// always generate smallest possible array to avoid huge JSON responses
|
||||||
$arrSize = ($maxSize < 1) ? $maxSize : max($minSize, 1);
|
$arrSize = ($maxSize < 1) ? $maxSize : max($minSize, 1);
|
||||||
while (count($arr) < $arrSize) {
|
while (count($arr) < $arrSize) {
|
||||||
$arr[] = $this->mock($dataType, $dataFormat, $options);
|
$data = $this->mockFromRef($ref);
|
||||||
|
$arr[] = ($data) ? $data : $this->mock($dataType, $dataFormat, $options);
|
||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
@@ -352,12 +358,62 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
$options = $this->extractSchemaProperties($propValue);
|
$options = $this->extractSchemaProperties($propValue);
|
||||||
$dataType = $options['type'];
|
$dataType = $options['type'];
|
||||||
$dataFormat = $options['dataFormat'] ?? null;
|
$dataFormat = $options['dataFormat'] ?? null;
|
||||||
$obj->$propName = $this->mock($dataType, $dataFormat, $options);
|
$ref = $options['$ref'] ?? null;
|
||||||
|
$data = $this->mockFromRef($ref);
|
||||||
|
$obj->$propName = ($data) ? $data : $this->mock($dataType, $dataFormat, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mocks OpenApi Data from schema.
|
||||||
|
*
|
||||||
|
* @param array|object $schema OpenAPI schema
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException when invalid arguments passed
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromSchema($schema)
|
||||||
|
{
|
||||||
|
$props = $this->extractSchemaProperties($schema);
|
||||||
|
if (array_key_exists('$ref', $props) && !empty($props['$ref'])) {
|
||||||
|
return $this->mockFromRef($props['$ref']);
|
||||||
|
} elseif ($props['type'] === null) {
|
||||||
|
throw new InvalidArgumentException('"schema" must be object or assoc array with "type" property');
|
||||||
|
}
|
||||||
|
return $this->mock($props['type'], $props['format'], $props);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mock data by referenced schema.
|
||||||
|
* TODO: this method will return model instance, not an StdClass
|
||||||
|
*
|
||||||
|
* @param string|null $ref Ref to model, eg. #/components/schemas/User
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromRef($ref)
|
||||||
|
{
|
||||||
|
$data = null;
|
||||||
|
if (is_string($ref) && !empty($ref)) {
|
||||||
|
$refName = static::getSimpleRef($ref);
|
||||||
|
$modelName = static::toModelName($refName);
|
||||||
|
$modelClass = 'OpenAPIServer\Model\\' . $modelName;
|
||||||
|
if (!class_exists($modelClass) || !method_exists($modelClass, 'getOpenApiSchema')) {
|
||||||
|
throw new InvalidArgumentException(sprintf(
|
||||||
|
'Model %s not found or method %s doesn\'t exist',
|
||||||
|
$modelClass,
|
||||||
|
$modelClass . '::getOpenApiSchema'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$data = $this->mockFromSchema($modelClass::getOpenApiSchema(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal Extract OAS properties from array or object.
|
* @internal Extract OAS properties from array or object.
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -394,6 +450,7 @@ final class OpenApiDataMocker implements IMocker
|
|||||||
'additionalProperties',
|
'additionalProperties',
|
||||||
'required',
|
'required',
|
||||||
'example',
|
'example',
|
||||||
|
'$ref',
|
||||||
] as $propName
|
] as $propName
|
||||||
) {
|
) {
|
||||||
if (is_array($val) && array_key_exists($propName, $val)) {
|
if (is_array($val) && array_key_exists($propName, $val)) {
|
||||||
|
|||||||
@@ -229,4 +229,27 @@ interface OpenApiDataMockerInterface
|
|||||||
$additionalProperties = null,
|
$additionalProperties = null,
|
||||||
$required = null
|
$required = null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mocks OpenApi Data from schema.
|
||||||
|
*
|
||||||
|
* @param array|object $schema OpenAPI schema
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException when invalid arguments passed
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromSchema($schema);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mock data by referenced schema.
|
||||||
|
* TODO: this method will return model instance, not an StdClass
|
||||||
|
*
|
||||||
|
* @param string|null $ref Ref to model, eg. #/components/schemas/User
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException when invalid arguments passed
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function mockFromRef($ref);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesAnyType
|
* AdditionalPropertiesAnyType
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,35 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesAnyType
|
class AdditionalPropertiesAnyType implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesArray
|
* AdditionalPropertiesArray
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,38 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesArray
|
class AdditionalPropertiesArray implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesBoolean
|
* AdditionalPropertiesBoolean
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,34 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesBoolean
|
class AdditionalPropertiesBoolean implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesClass
|
* AdditionalPropertiesClass
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,88 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesClass
|
class AdditionalPropertiesClass implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"map_string" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_number" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_integer" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_boolean" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_array_integer" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_array_anytype" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_map_string" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_map_anytype" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"anytype_1" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : { }
|
||||||
|
},
|
||||||
|
"anytype_2" : {
|
||||||
|
"type" : "object"
|
||||||
|
},
|
||||||
|
"anytype_3" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var map[string,string] $mapString */
|
/** @var map[string,string] $mapString */
|
||||||
private $mapString;
|
private $mapString;
|
||||||
@@ -58,4 +140,16 @@ class AdditionalPropertiesClass
|
|||||||
|
|
||||||
/** @var object $anytype3 */
|
/** @var object $anytype3 */
|
||||||
private $anytype3;
|
private $anytype3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesInteger
|
* AdditionalPropertiesInteger
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,34 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesInteger
|
class AdditionalPropertiesInteger implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesNumber
|
* AdditionalPropertiesNumber
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,34 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesNumber
|
class AdditionalPropertiesNumber implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesObject
|
* AdditionalPropertiesObject
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,38 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesObject
|
class AdditionalPropertiesObject implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdditionalPropertiesString
|
* AdditionalPropertiesString
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,34 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class AdditionalPropertiesString
|
class AdditionalPropertiesString implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,42 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Animal
|
class Animal implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "className" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"className" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"color" : {
|
||||||
|
"type" : "string",
|
||||||
|
"default" : "red"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"discriminator" : {
|
||||||
|
"propertyName" : "className"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $className */
|
/** @var string $className */
|
||||||
private $className;
|
private $className;
|
||||||
|
|
||||||
/** @var string $color */
|
/** @var string $color */
|
||||||
private $color;
|
private $color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApiResponse
|
* ApiResponse
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,25 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ApiResponse
|
class ApiResponse implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"code" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32"
|
||||||
|
},
|
||||||
|
"type" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"message" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $code */
|
/** @var int $code */
|
||||||
private $code;
|
private $code;
|
||||||
@@ -34,4 +53,16 @@ class ApiResponse
|
|||||||
|
|
||||||
/** @var string $message */
|
/** @var string $message */
|
||||||
private $message;
|
private $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayOfArrayOfNumberOnly
|
* ArrayOfArrayOfNumberOnly
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,37 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ArrayOfArrayOfNumberOnly
|
class ArrayOfArrayOfNumberOnly implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"ArrayArrayNumber" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var float[][] $arrayArrayNumber */
|
/** @var float[][] $arrayArrayNumber */
|
||||||
private $arrayArrayNumber;
|
private $arrayArrayNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayOfNumberOnly
|
* ArrayOfNumberOnly
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,34 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ArrayOfNumberOnly
|
class ArrayOfNumberOnly implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"ArrayNumber" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var float[] $arrayNumber */
|
/** @var float[] $arrayNumber */
|
||||||
private $arrayNumber;
|
private $arrayNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayTest
|
* ArrayTest
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,40 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ArrayTest
|
class ArrayTest implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"array_of_string" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"array_array_of_integer" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"array_array_of_model" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"$ref" : "#/components/schemas/ReadOnlyFirst"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string[] $arrayOfString */
|
/** @var string[] $arrayOfString */
|
||||||
private $arrayOfString;
|
private $arrayOfString;
|
||||||
@@ -34,4 +68,16 @@ class ArrayTest
|
|||||||
|
|
||||||
/** @var \OpenAPIServer\Model\ReadOnlyFirst[][] $arrayArrayOfModel */
|
/** @var \OpenAPIServer\Model\ReadOnlyFirst[][] $arrayArrayOfModel */
|
||||||
private $arrayArrayOfModel;
|
private $arrayArrayOfModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BigCat
|
* BigCat
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,17 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class BigCat
|
class BigCat implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"allOf" : [ {
|
||||||
|
"$ref" : "#/components/schemas/Cat"
|
||||||
|
}, {
|
||||||
|
"$ref" : "#/components/schemas/BigCat_allOf"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $className */
|
/** @var string $className */
|
||||||
private $className;
|
private $className;
|
||||||
@@ -37,4 +48,16 @@ class BigCat
|
|||||||
|
|
||||||
/** @var string $kind */
|
/** @var string $kind */
|
||||||
private $kind;
|
private $kind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BigCatAllOf
|
* BigCatAllOf
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,31 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class BigCatAllOf
|
class BigCatAllOf implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"properties" : {
|
||||||
|
"kind" : {
|
||||||
|
"type" : "string",
|
||||||
|
"enum" : [ "lions", "tigers", "leopards", "jaguars" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $kind */
|
/** @var string $kind */
|
||||||
private $kind;
|
private $kind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Capitalization
|
* Capitalization
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,34 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Capitalization
|
class Capitalization implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"smallCamel" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"CapitalCamel" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"small_Snake" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"Capital_Snake" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"SCA_ETH_Flow_Points" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"ATT_NAME" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Name of the pet\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $smallCamel */
|
/** @var string $smallCamel */
|
||||||
private $smallCamel;
|
private $smallCamel;
|
||||||
@@ -43,4 +71,16 @@ class Capitalization
|
|||||||
|
|
||||||
/** @var string $aTTNAME Name of the pet*/
|
/** @var string $aTTNAME Name of the pet*/
|
||||||
private $aTTNAME;
|
private $aTTNAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cat
|
* Cat
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,17 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Cat
|
class Cat implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"allOf" : [ {
|
||||||
|
"$ref" : "#/components/schemas/Animal"
|
||||||
|
}, {
|
||||||
|
"$ref" : "#/components/schemas/Cat_allOf"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $className */
|
/** @var string $className */
|
||||||
private $className;
|
private $className;
|
||||||
@@ -34,4 +45,16 @@ class Cat
|
|||||||
|
|
||||||
/** @var bool $declawed */
|
/** @var bool $declawed */
|
||||||
private $declawed;
|
private $declawed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CatAllOf
|
* CatAllOf
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,30 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class CatAllOf
|
class CatAllOf implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"properties" : {
|
||||||
|
"declawed" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var bool $declawed */
|
/** @var bool $declawed */
|
||||||
private $declawed;
|
private $declawed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category
|
* Category
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,43 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Category
|
class Category implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "name" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"id" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
},
|
||||||
|
"name" : {
|
||||||
|
"type" : "string",
|
||||||
|
"default" : "default-name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml" : {
|
||||||
|
"name" : "Category"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassModel
|
* ClassModel
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,32 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ClassModel
|
class ClassModel implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"_class" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "Model for testing model with \"_class\" property"
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $class */
|
/** @var string $class */
|
||||||
private $class;
|
private $class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client
|
* Client
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,31 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Client
|
class Client implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"client" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $client */
|
/** @var string $client */
|
||||||
private $client;
|
private $client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dog
|
* Dog
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,17 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Dog
|
class Dog implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"allOf" : [ {
|
||||||
|
"$ref" : "#/components/schemas/Animal"
|
||||||
|
}, {
|
||||||
|
"$ref" : "#/components/schemas/Dog_allOf"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $className */
|
/** @var string $className */
|
||||||
private $className;
|
private $className;
|
||||||
@@ -34,4 +45,16 @@ class Dog
|
|||||||
|
|
||||||
/** @var string $breed */
|
/** @var string $breed */
|
||||||
private $breed;
|
private $breed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DogAllOf
|
* DogAllOf
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,30 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class DogAllOf
|
class DogAllOf implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"properties" : {
|
||||||
|
"breed" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $breed */
|
/** @var string $breed */
|
||||||
private $breed;
|
private $breed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EnumArrays
|
* EnumArrays
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,42 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class EnumArrays
|
class EnumArrays implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"just_symbol" : {
|
||||||
|
"type" : "string",
|
||||||
|
"enum" : [ ">=", "$" ]
|
||||||
|
},
|
||||||
|
"array_enum" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "string",
|
||||||
|
"enum" : [ "fish", "crab" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $justSymbol */
|
/** @var string $justSymbol */
|
||||||
private $justSymbol;
|
private $justSymbol;
|
||||||
|
|
||||||
/** @var string[] $arrayEnum */
|
/** @var string[] $arrayEnum */
|
||||||
private $arrayEnum;
|
private $arrayEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EnumClass
|
* EnumClass
|
||||||
*
|
*
|
||||||
@@ -23,6 +25,25 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class EnumClass
|
class EnumClass implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "string",
|
||||||
|
"default" : "-efg",
|
||||||
|
"enum" : [ "_abc", "-efg", "(xyz)" ]
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EnumTest
|
* EnumTest
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,37 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class EnumTest
|
class EnumTest implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "enum_string_required" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"enum_string" : {
|
||||||
|
"type" : "string",
|
||||||
|
"enum" : [ "UPPER", "lower", "" ]
|
||||||
|
},
|
||||||
|
"enum_string_required" : {
|
||||||
|
"type" : "string",
|
||||||
|
"enum" : [ "UPPER", "lower", "" ]
|
||||||
|
},
|
||||||
|
"enum_integer" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32",
|
||||||
|
"enum" : [ 1, -1 ]
|
||||||
|
},
|
||||||
|
"enum_number" : {
|
||||||
|
"type" : "number",
|
||||||
|
"format" : "double",
|
||||||
|
"enum" : [ 1.1, -1.2 ]
|
||||||
|
},
|
||||||
|
"outerEnum" : {
|
||||||
|
"$ref" : "#/components/schemas/OuterEnum"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $enumString */
|
/** @var string $enumString */
|
||||||
private $enumString;
|
private $enumString;
|
||||||
@@ -40,4 +71,16 @@ class EnumTest
|
|||||||
|
|
||||||
/** @var \OpenAPIServer\Model\OuterEnum $outerEnum */
|
/** @var \OpenAPIServer\Model\OuterEnum $outerEnum */
|
||||||
private $outerEnum;
|
private $outerEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File
|
* File
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,33 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class File
|
class File implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"sourceURI" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Test capitalization"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "Must be named `File` for test."
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $sourceURI Test capitalization*/
|
/** @var string $sourceURI Test capitalization*/
|
||||||
private $sourceURI;
|
private $sourceURI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileSchemaTestClass
|
* FileSchemaTestClass
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,40 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class FileSchemaTestClass
|
class FileSchemaTestClass implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"file" : {
|
||||||
|
"$ref" : "#/components/schemas/File"
|
||||||
|
},
|
||||||
|
"files" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"$ref" : "#/components/schemas/File"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var \OpenAPIServer\Model\File $file */
|
/** @var \OpenAPIServer\Model\File $file */
|
||||||
private $file;
|
private $file;
|
||||||
|
|
||||||
/** @var \OpenAPIServer\Model\File[] $files */
|
/** @var \OpenAPIServer\Model\File[] $files */
|
||||||
private $files;
|
private $files;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FormatTest
|
* FormatTest
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,84 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class FormatTest
|
class FormatTest implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "byte", "date", "number", "password" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"integer" : {
|
||||||
|
"maximum" : 1E+2,
|
||||||
|
"minimum" : 1E+1,
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
|
"int32" : {
|
||||||
|
"maximum" : 2E+2,
|
||||||
|
"minimum" : 2E+1,
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32"
|
||||||
|
},
|
||||||
|
"int64" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
},
|
||||||
|
"number" : {
|
||||||
|
"maximum" : 543.2,
|
||||||
|
"minimum" : 32.1,
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"float" : {
|
||||||
|
"maximum" : 987.6,
|
||||||
|
"minimum" : 54.3,
|
||||||
|
"type" : "number",
|
||||||
|
"format" : "float"
|
||||||
|
},
|
||||||
|
"double" : {
|
||||||
|
"maximum" : 123.4,
|
||||||
|
"minimum" : 67.8,
|
||||||
|
"type" : "number",
|
||||||
|
"format" : "double"
|
||||||
|
},
|
||||||
|
"string" : {
|
||||||
|
"pattern" : "/[a-z]/i",
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"byte" : {
|
||||||
|
"pattern" : "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "byte"
|
||||||
|
},
|
||||||
|
"binary" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "binary"
|
||||||
|
},
|
||||||
|
"date" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "date"
|
||||||
|
},
|
||||||
|
"dateTime" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "date-time"
|
||||||
|
},
|
||||||
|
"uuid" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "uuid",
|
||||||
|
"example" : "72f98069-206d-4f12-9f12-3d1e525a8e84"
|
||||||
|
},
|
||||||
|
"password" : {
|
||||||
|
"maxLength" : 64,
|
||||||
|
"minLength" : 10,
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "password"
|
||||||
|
},
|
||||||
|
"BigDecimal" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $integer */
|
/** @var int $integer */
|
||||||
private $integer;
|
private $integer;
|
||||||
@@ -67,4 +145,16 @@ class FormatTest
|
|||||||
|
|
||||||
/** @var BigDecimal $bigDecimal */
|
/** @var BigDecimal $bigDecimal */
|
||||||
private $bigDecimal;
|
private $bigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HasOnlyReadOnly
|
* HasOnlyReadOnly
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,39 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class HasOnlyReadOnly
|
class HasOnlyReadOnly implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"bar" : {
|
||||||
|
"type" : "string",
|
||||||
|
"readOnly" : true
|
||||||
|
},
|
||||||
|
"foo" : {
|
||||||
|
"type" : "string",
|
||||||
|
"readOnly" : true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $bar */
|
/** @var string $bar */
|
||||||
private $bar;
|
private $bar;
|
||||||
|
|
||||||
/** @var string $foo */
|
/** @var string $foo */
|
||||||
private $foo;
|
private $foo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MapTest
|
* MapTest
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,40 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class MapTest
|
class MapTest implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"map_map_of_string" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_of_enum_string" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "string",
|
||||||
|
"enum" : [ "UPPER", "lower" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"direct_map" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indirect_map" : {
|
||||||
|
"$ref" : "#/components/schemas/StringBooleanMap"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var map[string,map[string,string]] $mapMapOfString */
|
/** @var map[string,map[string,string]] $mapMapOfString */
|
||||||
private $mapMapOfString;
|
private $mapMapOfString;
|
||||||
@@ -37,4 +71,16 @@ class MapTest
|
|||||||
|
|
||||||
/** @var map[string,bool] $indirectMap */
|
/** @var map[string,bool] $indirectMap */
|
||||||
private $indirectMap;
|
private $indirectMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MixedPropertiesAndAdditionalPropertiesClass
|
* MixedPropertiesAndAdditionalPropertiesClass
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,29 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class MixedPropertiesAndAdditionalPropertiesClass
|
class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"uuid" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "uuid"
|
||||||
|
},
|
||||||
|
"dateTime" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "date-time"
|
||||||
|
},
|
||||||
|
"map" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"$ref" : "#/components/schemas/Animal"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $uuid */
|
/** @var string $uuid */
|
||||||
private $uuid;
|
private $uuid;
|
||||||
@@ -34,4 +57,16 @@ class MixedPropertiesAndAdditionalPropertiesClass
|
|||||||
|
|
||||||
/** @var map[string,\OpenAPIServer\Model\Animal] $map */
|
/** @var map[string,\OpenAPIServer\Model\Animal] $map */
|
||||||
private $map;
|
private $map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model200Response
|
* Model200Response
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,42 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Model200Response
|
class Model200Response implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32"
|
||||||
|
},
|
||||||
|
"class" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "Model for testing model name starting with number",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $name */
|
/** @var int $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
/** @var string $class */
|
/** @var string $class */
|
||||||
private $class;
|
private $class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelList
|
* ModelList
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,31 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ModelList
|
class ModelList implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"123-list" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $_123list */
|
/** @var string $_123list */
|
||||||
private $_123list;
|
private $_123list;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelReturn
|
* ModelReturn
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,36 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ModelReturn
|
class ModelReturn implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"return" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "Model for testing reserved words",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "Return"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $return */
|
/** @var int $return */
|
||||||
private $return;
|
private $return;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name
|
* Name
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,36 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Name
|
class Name implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "name" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"name" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32"
|
||||||
|
},
|
||||||
|
"snake_case" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32",
|
||||||
|
"readOnly" : true
|
||||||
|
},
|
||||||
|
"property" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"123Number" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"readOnly" : true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "Model for testing model name same as property name",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $name */
|
/** @var int $name */
|
||||||
private $name;
|
private $name;
|
||||||
@@ -37,4 +67,16 @@ class Name
|
|||||||
|
|
||||||
/** @var int $_123number */
|
/** @var int $_123number */
|
||||||
private $_123number;
|
private $_123number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NumberOnly
|
* NumberOnly
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,31 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class NumberOnly
|
class NumberOnly implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"JustNumber" : {
|
||||||
|
"type" : "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var float $justNumber */
|
/** @var float $justNumber */
|
||||||
private $justNumber;
|
private $justNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order
|
* Order
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,43 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Order
|
class Order implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"id" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
},
|
||||||
|
"petId" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
},
|
||||||
|
"quantity" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int32"
|
||||||
|
},
|
||||||
|
"shipDate" : {
|
||||||
|
"type" : "string",
|
||||||
|
"format" : "date-time"
|
||||||
|
},
|
||||||
|
"status" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Order Status",
|
||||||
|
"enum" : [ "placed", "approved", "delivered" ]
|
||||||
|
},
|
||||||
|
"complete" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"default" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml" : {
|
||||||
|
"name" : "Order"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
private $id;
|
private $id;
|
||||||
@@ -43,4 +80,16 @@ class Order
|
|||||||
|
|
||||||
/** @var bool $complete */
|
/** @var bool $complete */
|
||||||
private $complete;
|
private $complete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OuterComposite
|
* OuterComposite
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,24 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class OuterComposite
|
class OuterComposite implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"my_number" : {
|
||||||
|
"$ref" : "#/components/schemas/OuterNumber"
|
||||||
|
},
|
||||||
|
"my_string" : {
|
||||||
|
"$ref" : "#/components/schemas/OuterString"
|
||||||
|
},
|
||||||
|
"my_boolean" : {
|
||||||
|
"$ref" : "#/components/schemas/OuterBoolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var float $myNumber */
|
/** @var float $myNumber */
|
||||||
private $myNumber;
|
private $myNumber;
|
||||||
@@ -34,4 +52,16 @@ class OuterComposite
|
|||||||
|
|
||||||
/** @var bool $myBoolean */
|
/** @var bool $myBoolean */
|
||||||
private $myBoolean;
|
private $myBoolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OuterEnum
|
* OuterEnum
|
||||||
*
|
*
|
||||||
@@ -23,6 +25,24 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class OuterEnum
|
class OuterEnum implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "string",
|
||||||
|
"enum" : [ "placed", "approved", "delivered" ]
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pet
|
* Pet
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,56 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Pet
|
class Pet implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "name", "photoUrls" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"id" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64",
|
||||||
|
"x-is-unique" : true
|
||||||
|
},
|
||||||
|
"category" : {
|
||||||
|
"$ref" : "#/components/schemas/Category"
|
||||||
|
},
|
||||||
|
"name" : {
|
||||||
|
"type" : "string",
|
||||||
|
"example" : "doggie"
|
||||||
|
},
|
||||||
|
"photoUrls" : {
|
||||||
|
"type" : "array",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "photoUrl",
|
||||||
|
"wrapped" : true
|
||||||
|
},
|
||||||
|
"items" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags" : {
|
||||||
|
"type" : "array",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "tag",
|
||||||
|
"wrapped" : true
|
||||||
|
},
|
||||||
|
"items" : {
|
||||||
|
"$ref" : "#/components/schemas/Tag"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "pet status in the store",
|
||||||
|
"enum" : [ "available", "pending", "sold" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml" : {
|
||||||
|
"name" : "Pet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
private $id;
|
private $id;
|
||||||
@@ -43,4 +93,16 @@ class Pet
|
|||||||
|
|
||||||
/** @var string $status pet status in the store*/
|
/** @var string $status pet status in the store*/
|
||||||
private $status;
|
private $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReadOnlyFirst
|
* ReadOnlyFirst
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,38 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class ReadOnlyFirst
|
class ReadOnlyFirst implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"bar" : {
|
||||||
|
"type" : "string",
|
||||||
|
"readOnly" : true
|
||||||
|
},
|
||||||
|
"baz" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $bar */
|
/** @var string $bar */
|
||||||
private $bar;
|
private $bar;
|
||||||
|
|
||||||
/** @var string $baz */
|
/** @var string $baz */
|
||||||
private $baz;
|
private $baz;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SpecialModelName
|
* SpecialModelName
|
||||||
*
|
*
|
||||||
@@ -23,9 +25,35 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class SpecialModelName
|
class SpecialModelName implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"$special[property.name]" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml" : {
|
||||||
|
"name" : "$special[model.name]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $specialPropertyName */
|
/** @var int $specialPropertyName */
|
||||||
private $specialPropertyName;
|
private $specialPropertyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag
|
* Tag
|
||||||
*
|
*
|
||||||
@@ -23,12 +25,41 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class Tag
|
class Tag implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"id" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
},
|
||||||
|
"name" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml" : {
|
||||||
|
"name" : "Tag"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TypeHolderDefault
|
* TypeHolderDefault
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,36 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class TypeHolderDefault
|
class TypeHolderDefault implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "array_item", "bool_item", "integer_item", "number_item", "string_item" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"string_item" : {
|
||||||
|
"type" : "string",
|
||||||
|
"default" : "what"
|
||||||
|
},
|
||||||
|
"number_item" : {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"integer_item" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
|
"bool_item" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"default" : true
|
||||||
|
},
|
||||||
|
"array_item" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $stringItem */
|
/** @var string $stringItem */
|
||||||
private $stringItem;
|
private $stringItem;
|
||||||
@@ -40,4 +70,16 @@ class TypeHolderDefault
|
|||||||
|
|
||||||
/** @var int[] $arrayItem */
|
/** @var int[] $arrayItem */
|
||||||
private $arrayItem;
|
private $arrayItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TypeHolderExample
|
* TypeHolderExample
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,44 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class TypeHolderExample
|
class TypeHolderExample implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "array_item", "bool_item", "float_item", "integer_item", "number_item", "string_item" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"string_item" : {
|
||||||
|
"type" : "string",
|
||||||
|
"example" : "what"
|
||||||
|
},
|
||||||
|
"number_item" : {
|
||||||
|
"type" : "number",
|
||||||
|
"example" : 1.234
|
||||||
|
},
|
||||||
|
"float_item" : {
|
||||||
|
"type" : "number",
|
||||||
|
"format" : "float",
|
||||||
|
"example" : 1.234
|
||||||
|
},
|
||||||
|
"integer_item" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"example" : -2
|
||||||
|
},
|
||||||
|
"bool_item" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"example" : true
|
||||||
|
},
|
||||||
|
"array_item" : {
|
||||||
|
"type" : "array",
|
||||||
|
"example" : [ 0, 1, 2, 3 ],
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $stringItem */
|
/** @var string $stringItem */
|
||||||
private $stringItem;
|
private $stringItem;
|
||||||
@@ -43,4 +81,16 @@ class TypeHolderExample
|
|||||||
|
|
||||||
/** @var int[] $arrayItem */
|
/** @var int[] $arrayItem */
|
||||||
private $arrayItem;
|
private $arrayItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User
|
* User
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,46 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class User
|
class User implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"id" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64",
|
||||||
|
"x-is-unique" : true
|
||||||
|
},
|
||||||
|
"username" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"firstName" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"lastName" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"email" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"password" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"phone" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"userStatus" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"description" : "User Status",
|
||||||
|
"format" : "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml" : {
|
||||||
|
"name" : "User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
private $id;
|
private $id;
|
||||||
@@ -49,4 +89,16 @@ class User
|
|||||||
|
|
||||||
/** @var int $userStatus User Status*/
|
/** @var int $userStatus User Status*/
|
||||||
private $userStatus;
|
private $userStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenAPIServer\Model;
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
use OpenAPIServer\Interfaces\ModelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XmlItem
|
* XmlItem
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,263 @@ namespace OpenAPIServer\Model;
|
|||||||
* @author OpenAPI Generator team
|
* @author OpenAPI Generator team
|
||||||
* @link https://github.com/openapitools/openapi-generator
|
* @link https://github.com/openapitools/openapi-generator
|
||||||
*/
|
*/
|
||||||
class XmlItem
|
class XmlItem implements ModelInterface
|
||||||
{
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"attribute_string" : {
|
||||||
|
"type" : "string",
|
||||||
|
"example" : "string",
|
||||||
|
"xml" : {
|
||||||
|
"attribute" : true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"attribute_number" : {
|
||||||
|
"type" : "number",
|
||||||
|
"example" : 1.234,
|
||||||
|
"xml" : {
|
||||||
|
"attribute" : true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"attribute_integer" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"example" : -2,
|
||||||
|
"xml" : {
|
||||||
|
"attribute" : true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"attribute_boolean" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"example" : true,
|
||||||
|
"xml" : {
|
||||||
|
"attribute" : true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wrapped_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"xml" : {
|
||||||
|
"wrapped" : true
|
||||||
|
},
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name_string" : {
|
||||||
|
"type" : "string",
|
||||||
|
"example" : "string",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "xml_name_string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name_number" : {
|
||||||
|
"type" : "number",
|
||||||
|
"example" : 1.234,
|
||||||
|
"xml" : {
|
||||||
|
"name" : "xml_name_number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name_integer" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"example" : -2,
|
||||||
|
"xml" : {
|
||||||
|
"name" : "xml_name_integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name_boolean" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"example" : true,
|
||||||
|
"xml" : {
|
||||||
|
"name" : "xml_name_boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "xml_name_array_item"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name_wrapped_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "xml_name_wrapped_array",
|
||||||
|
"wrapped" : true
|
||||||
|
},
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"name" : "xml_name_wrapped_array_item"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_string" : {
|
||||||
|
"type" : "string",
|
||||||
|
"example" : "string",
|
||||||
|
"xml" : {
|
||||||
|
"prefix" : "ab"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_number" : {
|
||||||
|
"type" : "number",
|
||||||
|
"example" : 1.234,
|
||||||
|
"xml" : {
|
||||||
|
"prefix" : "cd"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_integer" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"example" : -2,
|
||||||
|
"xml" : {
|
||||||
|
"prefix" : "ef"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_boolean" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"example" : true,
|
||||||
|
"xml" : {
|
||||||
|
"prefix" : "gh"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"prefix" : "ij"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_wrapped_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"xml" : {
|
||||||
|
"prefix" : "kl",
|
||||||
|
"wrapped" : true
|
||||||
|
},
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"prefix" : "mn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespace_string" : {
|
||||||
|
"type" : "string",
|
||||||
|
"example" : "string",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://a.com/schema"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespace_number" : {
|
||||||
|
"type" : "number",
|
||||||
|
"example" : 1.234,
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://b.com/schema"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespace_integer" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"example" : -2,
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://c.com/schema"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespace_boolean" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"example" : true,
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://d.com/schema"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespace_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://e.com/schema"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespace_wrapped_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://f.com/schema",
|
||||||
|
"wrapped" : true
|
||||||
|
},
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://g.com/schema"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_ns_string" : {
|
||||||
|
"type" : "string",
|
||||||
|
"example" : "string",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://a.com/schema",
|
||||||
|
"prefix" : "a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_ns_number" : {
|
||||||
|
"type" : "number",
|
||||||
|
"example" : 1.234,
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://b.com/schema",
|
||||||
|
"prefix" : "b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_ns_integer" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"example" : -2,
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://c.com/schema",
|
||||||
|
"prefix" : "c"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_ns_boolean" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"example" : true,
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://d.com/schema",
|
||||||
|
"prefix" : "d"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_ns_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://e.com/schema",
|
||||||
|
"prefix" : "e"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix_ns_wrapped_array" : {
|
||||||
|
"type" : "array",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://f.com/schema",
|
||||||
|
"prefix" : "f",
|
||||||
|
"wrapped" : true
|
||||||
|
},
|
||||||
|
"items" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://g.com/schema",
|
||||||
|
"prefix" : "g"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml" : {
|
||||||
|
"namespace" : "http://a.com/schema",
|
||||||
|
"prefix" : "pre"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
/** @var string $attributeString */
|
/** @var string $attributeString */
|
||||||
private $attributeString;
|
private $attributeString;
|
||||||
@@ -112,4 +369,16 @@ class XmlItem
|
|||||||
|
|
||||||
/** @var int[] $prefixNsWrappedArray */
|
/** @var int[] $prefixNsWrappedArray */
|
||||||
private $prefixNsWrappedArray;
|
private $prefixNsWrappedArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns model schema.
|
||||||
|
*
|
||||||
|
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays. Default FALSE.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getOpenApiSchema($assoc = false)
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, $assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ use OpenAPIServer\Mock\OpenApiDataMockerInterface as IMocker;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use PHPUnit\Framework\Constraint\IsType;
|
use PHPUnit\Framework\Constraint\IsType;
|
||||||
use StdClass;
|
use StdClass;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OpenApiDataMockerTest Class Doc Comment
|
* OpenApiDataMockerTest Class Doc Comment
|
||||||
@@ -95,6 +96,18 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::mock
|
||||||
|
*/
|
||||||
|
public function testMockWithStringEnumOptions()
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$string = $mocker->mock(IMocker::DATA_TYPE_STRING, null, [
|
||||||
|
'enum' => ['foobar', 'foobaz', 'helloworld'],
|
||||||
|
]);
|
||||||
|
$this->assertContains($string, ['foobar', 'foobaz', 'helloworld']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideMockIntegerCorrectArguments
|
* @dataProvider provideMockIntegerCorrectArguments
|
||||||
* @covers ::mockInteger
|
* @covers ::mockInteger
|
||||||
@@ -639,6 +652,45 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
'maxItems less than minItems' => [
|
'maxItems less than minItems' => [
|
||||||
$intItems, 5, 2, false,
|
$intItems, 5, 2, false,
|
||||||
],
|
],
|
||||||
|
'items with ref to unknown class' => [
|
||||||
|
['$ref' => '#/components/schemas/UnknownClass'], null, null, false,
|
||||||
|
],
|
||||||
|
'items with ref to class without getOpenApiSchema method' => [
|
||||||
|
['$ref' => '#/components/schemas/ClassWithoutGetSchemaMethod'], null, null, false,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockArrayWithRefArguments
|
||||||
|
* @covers ::mockArray
|
||||||
|
*/
|
||||||
|
public function testMockArrayWithRef($items, $expectedStructure)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$arr = $mocker->mockArray($items);
|
||||||
|
$this->assertIsArray($arr);
|
||||||
|
$this->assertCount(1, $arr);
|
||||||
|
foreach ($arr as $item) {
|
||||||
|
// TODO: replace with assertInstanceOf assertion
|
||||||
|
$this->assertInternalType(IsType::TYPE_OBJECT, $item);
|
||||||
|
foreach ($expectedStructure as $expectedProp => $expectedType) {
|
||||||
|
$this->assertInternalType($expectedType, $item->$expectedProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockArrayWithRefArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'items with ref to CatRefTestClass' => [
|
||||||
|
['$ref' => '#/components/schemas/CatRefTestClass'],
|
||||||
|
[
|
||||||
|
'className' => IsType::TYPE_STRING,
|
||||||
|
'color' => IsType::TYPE_STRING,
|
||||||
|
'declawed' => IsType::TYPE_BOOL,
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,6 +775,9 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
'properties cannot be a string' => [
|
'properties cannot be a string' => [
|
||||||
'foobar', 0, 10, false, null,
|
'foobar', 0, 10, false, null,
|
||||||
],
|
],
|
||||||
|
'property value cannot be a string' => [
|
||||||
|
['username' => 'foobar'], 0, 10, false, null,
|
||||||
|
],
|
||||||
'minProperties is not integer' => [
|
'minProperties is not integer' => [
|
||||||
[], 3.12, null, false, null,
|
[], 3.12, null, false, null,
|
||||||
],
|
],
|
||||||
@@ -761,4 +816,219 @@ class OpenApiDataMockerTest extends TestCase
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::mockObject
|
||||||
|
*/
|
||||||
|
public function testMockObjectWithReferencedProps()
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$obj = $mocker->mockObject(
|
||||||
|
(object) [
|
||||||
|
'cat' => [
|
||||||
|
'$ref' => '#/components/schemas/CatRefTestClass',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->assertInternalType(IsType::TYPE_OBJECT, $obj->cat);
|
||||||
|
$this->assertInternalType(IsType::TYPE_STRING, $obj->cat->className);
|
||||||
|
$this->assertInternalType(IsType::TYPE_STRING, $obj->cat->color);
|
||||||
|
$this->assertInternalType(IsType::TYPE_BOOL, $obj->cat->declawed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromSchemaCorrectArguments
|
||||||
|
* @covers ::mockFromSchema
|
||||||
|
*/
|
||||||
|
public function testMockFromSchemaWithCorrectArguments($schema, $expectedType)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromSchema($schema);
|
||||||
|
$this->assertInternalType($expectedType, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockFromSchemaCorrectArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'string from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'string from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'integer from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_INTEGER],
|
||||||
|
IsType::TYPE_INT,
|
||||||
|
],
|
||||||
|
'integer from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_INTEGER],
|
||||||
|
IsType::TYPE_INT,
|
||||||
|
],
|
||||||
|
'number from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_NUMBER],
|
||||||
|
IsType::TYPE_FLOAT,
|
||||||
|
],
|
||||||
|
'number from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_NUMBER],
|
||||||
|
IsType::TYPE_FLOAT,
|
||||||
|
],
|
||||||
|
'string from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'string from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
IsType::TYPE_STRING,
|
||||||
|
],
|
||||||
|
'boolean from object' => [
|
||||||
|
(object) ['type' => IMocker::DATA_TYPE_BOOLEAN],
|
||||||
|
IsType::TYPE_BOOL,
|
||||||
|
],
|
||||||
|
'boolean from array' => [
|
||||||
|
['type' => IMocker::DATA_TYPE_BOOLEAN],
|
||||||
|
IsType::TYPE_BOOL,
|
||||||
|
],
|
||||||
|
'array of strings from object' => [
|
||||||
|
(object) [
|
||||||
|
'type' => IMocker::DATA_TYPE_ARRAY,
|
||||||
|
'items' => ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
],
|
||||||
|
IsType::TYPE_ARRAY,
|
||||||
|
],
|
||||||
|
'array of strings from array' => [
|
||||||
|
[
|
||||||
|
'type' => IMocker::DATA_TYPE_ARRAY,
|
||||||
|
'items' => ['type' => IMocker::DATA_TYPE_STRING],
|
||||||
|
],
|
||||||
|
IsType::TYPE_ARRAY,
|
||||||
|
],
|
||||||
|
'object with username prop from object' => [
|
||||||
|
(object) [
|
||||||
|
'type' => IMocker::DATA_TYPE_OBJECT,
|
||||||
|
'properties' => ['username' => ['type' => IMocker::DATA_TYPE_STRING]],
|
||||||
|
],
|
||||||
|
IsType::TYPE_OBJECT,
|
||||||
|
],
|
||||||
|
'object with username prop from array' => [
|
||||||
|
[
|
||||||
|
'type' => IMocker::DATA_TYPE_OBJECT,
|
||||||
|
'properties' => ['username' => ['type' => IMocker::DATA_TYPE_STRING]],
|
||||||
|
],
|
||||||
|
IsType::TYPE_OBJECT,
|
||||||
|
],
|
||||||
|
'referenced class' => [
|
||||||
|
['$ref' => '#/components/schemas/CatRefTestClass'],
|
||||||
|
IsType::TYPE_OBJECT,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromSchemaInvalidArguments
|
||||||
|
* @expectedException \InvalidArgumentException
|
||||||
|
* @covers ::mockFromSchema
|
||||||
|
*/
|
||||||
|
public function testMockFromSchemaWithInvalidArguments($schema)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromSchema($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function provideMockFromSchemaInvalidArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'null' => [null],
|
||||||
|
'numeric' => [3.14],
|
||||||
|
'empty array' => [[]],
|
||||||
|
'empty object' => [(object) []],
|
||||||
|
'string' => ['foobar'],
|
||||||
|
'DateTime object' => [new DateTime()],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromRefCorrectArguments
|
||||||
|
* @covers ::mockFromRef
|
||||||
|
*/
|
||||||
|
public function testMockFromRefWithCorrectArguments($ref, $expectedStructure)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromRef($ref);
|
||||||
|
foreach ($expectedStructure as $expectedProp => $expectedType) {
|
||||||
|
$this->assertInternalType($expectedType, $data->$expectedProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockFromRefCorrectArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'CatRefTestClass model' => [
|
||||||
|
'#/components/schemas/CatRefTestClass',
|
||||||
|
[
|
||||||
|
'className' => IsType::TYPE_STRING,
|
||||||
|
'color' => IsType::TYPE_STRING,
|
||||||
|
'declawed' => IsType::TYPE_BOOL,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMockFromRefInvalidArguments
|
||||||
|
* @expectedException \InvalidArgumentException
|
||||||
|
* @covers ::mockFromRef
|
||||||
|
*/
|
||||||
|
public function testMockFromRefWithInvalidArguments($ref)
|
||||||
|
{
|
||||||
|
$mocker = new OpenApiDataMocker();
|
||||||
|
$data = $mocker->mockFromRef($ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMockFromRefInvalidArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'ref to unknown class' => ['#/components/schemas/UnknownClass'],
|
||||||
|
'ref to class without getOpenApiSchema method' => ['#/components/schemas/ClassWithoutGetSchemaMethod'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace OpenAPIServer\Model;
|
||||||
|
|
||||||
|
// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
|
||||||
|
final class CatRefTestClass
|
||||||
|
{
|
||||||
|
private const MODEL_SCHEMA = <<<'SCHEMA'
|
||||||
|
{
|
||||||
|
"required" : [ "className" ],
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"className" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"color" : {
|
||||||
|
"type" : "string",
|
||||||
|
"default" : "red"
|
||||||
|
},
|
||||||
|
"declawed" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"discriminator" : {
|
||||||
|
"propertyName" : "className"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SCHEMA;
|
||||||
|
|
||||||
|
public static function getOpenApiSchema()
|
||||||
|
{
|
||||||
|
return json_decode(static::MODEL_SCHEMA, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final class ClassWithoutGetSchemaMethod
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user