forked from loafle/openapi-generator-original
Fix alias to map in the model's properties (#360)
* add test case for ref to map (boolean) in fake petstore spec * fix alias to map in model properties * remove logging from new method * update samples for the new map test case * fix javadoc string * skip testSanitizeNestedInvalidValue in php test * skip test in php oas3 client * add logic to handle outer enum * update samples * fix alias in model's allOf * generate models for map def * update petstore samples * update petstore samples
This commit is contained in:
@@ -58,7 +58,9 @@ class MapTest implements ModelInterface, ArrayAccess
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'map_map_of_string' => 'map[string,map[string,string]]',
|
||||
'map_of_enum_string' => 'map[string,string]'
|
||||
'map_of_enum_string' => 'map[string,string]',
|
||||
'direct_map' => 'map[string,bool]',
|
||||
'indirect_map' => '\OpenAPI\Client\Model\StringBooleanMap'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -68,7 +70,9 @@ class MapTest implements ModelInterface, ArrayAccess
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'map_map_of_string' => null,
|
||||
'map_of_enum_string' => null
|
||||
'map_of_enum_string' => null,
|
||||
'direct_map' => null,
|
||||
'indirect_map' => null
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -99,7 +103,9 @@ class MapTest implements ModelInterface, ArrayAccess
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'map_map_of_string' => 'map_map_of_string',
|
||||
'map_of_enum_string' => 'map_of_enum_string'
|
||||
'map_of_enum_string' => 'map_of_enum_string',
|
||||
'direct_map' => 'direct_map',
|
||||
'indirect_map' => 'indirect_map'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -109,7 +115,9 @@ class MapTest implements ModelInterface, ArrayAccess
|
||||
*/
|
||||
protected static $setters = [
|
||||
'map_map_of_string' => 'setMapMapOfString',
|
||||
'map_of_enum_string' => 'setMapOfEnumString'
|
||||
'map_of_enum_string' => 'setMapOfEnumString',
|
||||
'direct_map' => 'setDirectMap',
|
||||
'indirect_map' => 'setIndirectMap'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -119,7 +127,9 @@ class MapTest implements ModelInterface, ArrayAccess
|
||||
*/
|
||||
protected static $getters = [
|
||||
'map_map_of_string' => 'getMapMapOfString',
|
||||
'map_of_enum_string' => 'getMapOfEnumString'
|
||||
'map_of_enum_string' => 'getMapOfEnumString',
|
||||
'direct_map' => 'getDirectMap',
|
||||
'indirect_map' => 'getIndirectMap'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -199,6 +209,8 @@ class MapTest implements ModelInterface, ArrayAccess
|
||||
{
|
||||
$this->container['map_map_of_string'] = isset($data['map_map_of_string']) ? $data['map_map_of_string'] : null;
|
||||
$this->container['map_of_enum_string'] = isset($data['map_of_enum_string']) ? $data['map_of_enum_string'] : null;
|
||||
$this->container['direct_map'] = isset($data['direct_map']) ? $data['direct_map'] : null;
|
||||
$this->container['indirect_map'] = isset($data['indirect_map']) ? $data['indirect_map'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,6 +293,54 @@ class MapTest implements ModelInterface, ArrayAccess
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets direct_map
|
||||
*
|
||||
* @return map[string,bool]|null
|
||||
*/
|
||||
public function getDirectMap()
|
||||
{
|
||||
return $this->container['direct_map'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets direct_map
|
||||
*
|
||||
* @param map[string,bool]|null $direct_map direct_map
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDirectMap($direct_map)
|
||||
{
|
||||
$this->container['direct_map'] = $direct_map;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets indirect_map
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\StringBooleanMap|null
|
||||
*/
|
||||
public function getIndirectMap()
|
||||
{
|
||||
return $this->container['indirect_map'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets indirect_map
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\StringBooleanMap|null $indirect_map indirect_map
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIndirectMap($indirect_map)
|
||||
{
|
||||
$this->container['indirect_map'] = $indirect_map;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
/**
|
||||
* StringBooleanMap
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* StringBooleanMap Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class StringBooleanMap implements ModelInterface, ArrayAccess
|
||||
{
|
||||
const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'StringBooleanMap';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = parent::listInvalidProperties();
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return isset($this->container[$offset]) ? $this->container[$offset] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user