forked from loafle/openapi-generator-original
Better inline model resolver to handle inline schema in array item (#12104)
* better support of inline schema in array item * update tests * update samples * regenerate samples * fix allof naming, remove files * add files * update samples * update readme * fix tests * update samples * update samples * add new files * update test spec * add back tests * remove unused files * comment out python test * update js test using own spec * remove files * remove unused files * remove files * remove unused files * better handling of allOf with a single type * comment out go test * remove test_all_of_with_single_ref_single_ref_type.py * fix inline resolver, uncomment go test
This commit is contained in:
@@ -11,6 +11,7 @@ docs/Api/PetApi.md
|
||||
docs/Api/StoreApi.md
|
||||
docs/Api/UserApi.md
|
||||
docs/Model/AdditionalPropertiesClass.md
|
||||
docs/Model/AllOfWithSingleRef.md
|
||||
docs/Model/Animal.md
|
||||
docs/Model/ApiResponse.md
|
||||
docs/Model/ArrayOfArrayOfNumberOnly.md
|
||||
@@ -53,10 +54,10 @@ docs/Model/OuterEnumIntegerDefaultValue.md
|
||||
docs/Model/OuterObjectWithEnumProperty.md
|
||||
docs/Model/Pet.md
|
||||
docs/Model/ReadOnlyFirst.md
|
||||
docs/Model/SingleRefType.md
|
||||
docs/Model/SpecialModelName.md
|
||||
docs/Model/Tag.md
|
||||
docs/Model/User.md
|
||||
docs/Model/UserType.md
|
||||
git_push.sh
|
||||
lib/Api/AnotherFakeApi.php
|
||||
lib/Api/DefaultApi.php
|
||||
@@ -69,6 +70,7 @@ lib/ApiException.php
|
||||
lib/Configuration.php
|
||||
lib/HeaderSelector.php
|
||||
lib/Model/AdditionalPropertiesClass.php
|
||||
lib/Model/AllOfWithSingleRef.php
|
||||
lib/Model/Animal.php
|
||||
lib/Model/ApiResponse.php
|
||||
lib/Model/ArrayOfArrayOfNumberOnly.php
|
||||
@@ -112,9 +114,9 @@ lib/Model/OuterEnumIntegerDefaultValue.php
|
||||
lib/Model/OuterObjectWithEnumProperty.php
|
||||
lib/Model/Pet.php
|
||||
lib/Model/ReadOnlyFirst.php
|
||||
lib/Model/SingleRefType.php
|
||||
lib/Model/SpecialModelName.php
|
||||
lib/Model/Tag.php
|
||||
lib/Model/User.php
|
||||
lib/Model/UserType.php
|
||||
lib/ObjectSerializer.php
|
||||
phpunit.xml.dist
|
||||
|
||||
@@ -117,6 +117,7 @@ Class | Method | HTTP request | Description
|
||||
## Models
|
||||
|
||||
- [AdditionalPropertiesClass](docs/Model/AdditionalPropertiesClass.md)
|
||||
- [AllOfWithSingleRef](docs/Model/AllOfWithSingleRef.md)
|
||||
- [Animal](docs/Model/Animal.md)
|
||||
- [ApiResponse](docs/Model/ApiResponse.md)
|
||||
- [ArrayOfArrayOfNumberOnly](docs/Model/ArrayOfArrayOfNumberOnly.md)
|
||||
@@ -159,10 +160,10 @@ Class | Method | HTTP request | Description
|
||||
- [OuterObjectWithEnumProperty](docs/Model/OuterObjectWithEnumProperty.md)
|
||||
- [Pet](docs/Model/Pet.md)
|
||||
- [ReadOnlyFirst](docs/Model/ReadOnlyFirst.md)
|
||||
- [SingleRefType](docs/Model/SingleRefType.md)
|
||||
- [SpecialModelName](docs/Model/SpecialModelName.md)
|
||||
- [Tag](docs/Model/Tag.md)
|
||||
- [User](docs/Model/User.md)
|
||||
- [UserType](docs/Model/UserType.md)
|
||||
|
||||
## Authorization
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# # AllOfWithSingleRef
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**username** | **string** | | [optional]
|
||||
**single_ref_type** | [**SingleRefType**](SingleRefType.md) | | [optional]
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
||||
@@ -1,4 +1,4 @@
|
||||
# # UserType
|
||||
# # SingleRefType
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -12,6 +12,5 @@ Name | Type | Description | Notes
|
||||
**password** | **string** | | [optional]
|
||||
**phone** | **string** | | [optional]
|
||||
**user_status** | **int** | User Status | [optional]
|
||||
**user_type** | [**UserType**](UserType.md) | | [optional]
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
/**
|
||||
* AllOfWithSingleRef
|
||||
*
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.0.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;
|
||||
|
||||
/**
|
||||
* AllOfWithSingleRef Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<TKey, TValue>
|
||||
* @template TKey int|null
|
||||
* @template TValue mixed|null
|
||||
*/
|
||||
class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'AllOfWithSingleRef';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'username' => 'string',
|
||||
'single_ref_type' => 'SingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'username' => null,
|
||||
'single_ref_type' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 = [
|
||||
'username' => 'username',
|
||||
'single_ref_type' => 'SingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'username' => 'setUsername',
|
||||
'single_ref_type' => 'setSingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'username' => 'getUsername',
|
||||
'single_ref_type' => 'getSingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$this->container['username'] = $data['username'] ?? null;
|
||||
$this->container['single_ref_type'] = $data['single_ref_type'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets username
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->container['username'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets username
|
||||
*
|
||||
* @param string|null $username username
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->container['username'] = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets single_ref_type
|
||||
*
|
||||
* @return SingleRefType|null
|
||||
*/
|
||||
public function getSingleRefType()
|
||||
{
|
||||
return $this->container['single_ref_type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets single_ref_type
|
||||
*
|
||||
* @param SingleRefType|null $single_ref_type single_ref_type
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSingleRefType($single_ref_type)
|
||||
{
|
||||
$this->container['single_ref_type'] = $single_ref_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* UserType
|
||||
* SingleRefType
|
||||
*
|
||||
* PHP version 7.3
|
||||
*
|
||||
@@ -30,14 +30,14 @@ namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* UserType Class Doc Comment
|
||||
* SingleRefType Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class UserType
|
||||
class SingleRefType
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
@@ -66,8 +66,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'user_status' => 'int',
|
||||
'user_type' => 'UserType'
|
||||
'user_status' => 'int'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -85,8 +84,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => null,
|
||||
'password' => null,
|
||||
'phone' => null,
|
||||
'user_status' => 'int32',
|
||||
'user_type' => null
|
||||
'user_status' => 'int32'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -123,8 +121,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'email',
|
||||
'password' => 'password',
|
||||
'phone' => 'phone',
|
||||
'user_status' => 'userStatus',
|
||||
'user_type' => 'userType'
|
||||
'user_status' => 'userStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -140,8 +137,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'setEmail',
|
||||
'password' => 'setPassword',
|
||||
'phone' => 'setPhone',
|
||||
'user_status' => 'setUserStatus',
|
||||
'user_type' => 'setUserType'
|
||||
'user_status' => 'setUserStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -157,8 +153,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'getEmail',
|
||||
'password' => 'getPassword',
|
||||
'phone' => 'getPhone',
|
||||
'user_status' => 'getUserStatus',
|
||||
'user_type' => 'getUserType'
|
||||
'user_status' => 'getUserStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -226,7 +221,6 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
$this->container['password'] = $data['password'] ?? null;
|
||||
$this->container['phone'] = $data['phone'] ?? null;
|
||||
$this->container['user_status'] = $data['user_status'] ?? null;
|
||||
$this->container['user_type'] = $data['user_type'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -444,30 +438,6 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user_type
|
||||
*
|
||||
* @return UserType|null
|
||||
*/
|
||||
public function getUserType()
|
||||
{
|
||||
return $this->container['user_type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user_type
|
||||
*
|
||||
* @param UserType|null $user_type user_type
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUserType($user_type)
|
||||
{
|
||||
$this->container['user_type'] = $user_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* AllOfWithSingleRefTest
|
||||
*
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Test\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* AllOfWithSingleRefTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description AllOfWithSingleRef
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class AllOfWithSingleRefTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test case
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "AllOfWithSingleRef"
|
||||
*/
|
||||
public function testAllOfWithSingleRef()
|
||||
{
|
||||
// TODO: implement
|
||||
$this->markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "username"
|
||||
*/
|
||||
public function testPropertyUsername()
|
||||
{
|
||||
// TODO: implement
|
||||
$this->markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test attribute "single_ref_type"
|
||||
*/
|
||||
public function testPropertySingleRefType()
|
||||
{
|
||||
// TODO: implement
|
||||
$this->markTestIncomplete('Not implemented');
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* UserTypeTest
|
||||
* SingleRefTypeTest
|
||||
*
|
||||
* PHP version 7.3
|
||||
*
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 5.3.1-SNAPSHOT
|
||||
* OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -31,15 +31,15 @@ namespace OpenAPI\Client\Test\Model;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* UserTypeTest Class Doc Comment
|
||||
* SingleRefTypeTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description UserType
|
||||
* @description SingleRefType
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class UserTypeTest extends TestCase
|
||||
class SingleRefTypeTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -71,9 +71,9 @@ class UserTypeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "UserType"
|
||||
* Test "SingleRefType"
|
||||
*/
|
||||
public function testUserType()
|
||||
public function testSingleRefType()
|
||||
{
|
||||
// TODO: implement
|
||||
$this->markTestIncomplete('Not implemented');
|
||||
Reference in New Issue
Block a user