Skip to content

Commit 8f1bfd7

Browse files
committed
Fixed an issue where the way null values were specified in the master openapi definition were not supported by the php generator. This should fix the errors thrown in the gcCreateChannel function
1 parent 1d4f4f5 commit 8f1bfd7

File tree

5 files changed

+155
-38
lines changed

5 files changed

+155
-38
lines changed

docs/Model/SendBirdMember.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Name | Type | Description | Notes
2121
**muted_end_at** | **float** | | [optional]
2222
**muted_description** | **string** | | [optional]
2323
**restriction_info** | [**\Sendbird\Model\SendBirdRestrictionInfo**](SendBirdRestrictionInfo.md) | | [optional]
24-
**role** | **string** | | [optional]
24+
**role** | [**\Sendbird\Model\SendBirdMemberRole**](SendBirdMemberRole.md) | | [optional]
2525
**state** | **string** | | [optional]
2626
**user_id** | **string** | | [optional]
2727

docs/Model/SendBirdMemberRole.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# # SendBirdMemberRole
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
8+
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

lib/Model/SendBirdMember.php

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SendBirdMember implements ModelInterface, ArrayAccess, \JsonSerializable
7474
'muted_end_at' => 'float',
7575
'muted_description' => 'string',
7676
'restriction_info' => '\Sendbird\Model\SendBirdRestrictionInfo',
77-
'role' => 'string',
77+
'role' => '\Sendbird\Model\SendBirdMemberRole',
7878
'state' => 'string',
7979
'user_id' => 'string'
8080
];
@@ -255,24 +255,9 @@ public function getModelName()
255255
return self::$openAPIModelName;
256256
}
257257

258-
public const ROLE_NONE = 'none';
259-
public const ROLE_OPERATOR = 'operator';
260258
public const STATE_INVITED = 'invited';
261259
public const STATE_JOINED = 'joined';
262260

263-
/**
264-
* Gets allowable values of the enum
265-
*
266-
* @return string[]
267-
*/
268-
public function getRoleAllowableValues()
269-
{
270-
return [
271-
self::ROLE_NONE,
272-
self::ROLE_OPERATOR,
273-
];
274-
}
275-
276261
/**
277262
* Gets allowable values of the enum
278263
*
@@ -332,15 +317,6 @@ public function listInvalidProperties()
332317
{
333318
$invalidProperties = [];
334319

335-
$allowedValues = $this->getRoleAllowableValues();
336-
if (!is_null($this->container['role']) && !in_array($this->container['role'], $allowedValues, true)) {
337-
$invalidProperties[] = sprintf(
338-
"invalid value '%s' for 'role', must be one of '%s'",
339-
$this->container['role'],
340-
implode("', '", $allowedValues)
341-
);
342-
}
343-
344320
$allowedValues = $this->getStateAllowableValues();
345321
if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) {
346322
$invalidProperties[] = sprintf(
@@ -776,7 +752,7 @@ public function setRestrictionInfo($restriction_info)
776752
/**
777753
* Gets role
778754
*
779-
* @return string|null
755+
* @return \Sendbird\Model\SendBirdMemberRole|null
780756
*/
781757
public function getRole()
782758
{
@@ -786,22 +762,12 @@ public function getRole()
786762
/**
787763
* Sets role
788764
*
789-
* @param string|null $role role
765+
* @param \Sendbird\Model\SendBirdMemberRole|null $role role
790766
*
791767
* @return self
792768
*/
793769
public function setRole($role)
794770
{
795-
$allowedValues = $this->getRoleAllowableValues();
796-
if (!is_null($role) && !in_array($role, $allowedValues, true)) {
797-
throw new \InvalidArgumentException(
798-
sprintf(
799-
"Invalid value '%s' for 'role', must be one of '%s'",
800-
$role,
801-
implode("', '", $allowedValues)
802-
)
803-
);
804-
}
805771
$this->container['role'] = $role;
806772

807773
return $this;

lib/Model/SendBirdMemberRole.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* SendBirdMemberRole
4+
*
5+
* PHP version 7.4
6+
*
7+
* @category Class
8+
* @package Sendbird
9+
* @author OpenAPI Generator team
10+
* @link https://openapi-generator.tech
11+
*/
12+
13+
/**
14+
* Sendbird Platform SDK
15+
*
16+
* Sendbird Platform API Javascript SDK https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api
17+
*
18+
* The version of the OpenAPI document: 1.0.0
19+
* Generated by: https://openapi-generator.tech
20+
* OpenAPI Generator version: 6.0.1
21+
*/
22+
23+
/**
24+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
25+
* https://openapi-generator.tech
26+
* Do not edit the class manually.
27+
*/
28+
29+
namespace Sendbird\Model;
30+
use \Sendbird\ObjectSerializer;
31+
32+
/**
33+
* SendBirdMemberRole Class Doc Comment
34+
*
35+
* @category Class
36+
* @package Sendbird
37+
* @author OpenAPI Generator team
38+
* @link https://openapi-generator.tech
39+
*/
40+
class SendBirdMemberRole
41+
{
42+
/**
43+
* Possible values of this enum
44+
*/
45+
public const NUMBER_NONE = 'none';
46+
47+
public const NUMBER_OPERATOR = 'operator';
48+
49+
/**
50+
* Gets allowable values of the enum
51+
* @return string[]
52+
*/
53+
public static function getAllowableEnumValues()
54+
{
55+
return [
56+
self::NUMBER_NONE,
57+
self::NUMBER_OPERATOR
58+
];
59+
}
60+
}
61+
62+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* SendBirdMemberRoleTest
4+
*
5+
* PHP version 7.4
6+
*
7+
* @category Class
8+
* @package Sendbird
9+
* @author OpenAPI Generator team
10+
* @link https://openapi-generator.tech
11+
*/
12+
13+
/**
14+
* Sendbird Platform SDK
15+
*
16+
* Sendbird Platform API Javascript SDK https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api
17+
*
18+
* The version of the OpenAPI document: 1.0.0
19+
* Generated by: https://openapi-generator.tech
20+
* OpenAPI Generator version: 6.0.1
21+
*/
22+
23+
/**
24+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
25+
* https://openapi-generator.tech
26+
* Please update the test case below to test the model.
27+
*/
28+
29+
namespace Sendbird\Test\Model;
30+
31+
use PHPUnit\Framework\TestCase;
32+
33+
/**
34+
* SendBirdMemberRoleTest Class Doc Comment
35+
*
36+
* @category Class
37+
* @description SendBirdMemberRole
38+
* @package Sendbird
39+
* @author OpenAPI Generator team
40+
* @link https://openapi-generator.tech
41+
*/
42+
class SendBirdMemberRoleTest extends TestCase
43+
{
44+
45+
/**
46+
* Setup before running any test case
47+
*/
48+
public static function setUpBeforeClass(): void
49+
{
50+
}
51+
52+
/**
53+
* Setup before running each test case
54+
*/
55+
public function setUp(): void
56+
{
57+
}
58+
59+
/**
60+
* Clean up after running each test case
61+
*/
62+
public function tearDown(): void
63+
{
64+
}
65+
66+
/**
67+
* Clean up after running all test cases
68+
*/
69+
public static function tearDownAfterClass(): void
70+
{
71+
}
72+
73+
/**
74+
* Test "SendBirdMemberRole"
75+
*/
76+
public function testSendBirdMemberRole()
77+
{
78+
// TODO: implement
79+
$this->markTestIncomplete('Not implemented');
80+
}
81+
}

0 commit comments

Comments
 (0)