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
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
namespace OpenAPIServer\Model;
|
||||
|
||||
use OpenAPIServer\Interfaces\ModelInterface;
|
||||
|
||||
/**
|
||||
* MapTest
|
||||
*
|
||||
@@ -23,18 +25,62 @@ namespace OpenAPIServer\Model;
|
||||
* @author OpenAPI Generator team
|
||||
* @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 */
|
||||
private $mapMapOfString;
|
||||
|
||||
|
||||
/** @var map[string,string] $mapOfEnumString */
|
||||
private $mapOfEnumString;
|
||||
|
||||
|
||||
/** @var map[string,bool] $directMap */
|
||||
private $directMap;
|
||||
|
||||
|
||||
/** @var map[string,bool] $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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user