Skip to content

Commit 3dea915

Browse files
committed
adding "omitempty" and "skip" functionality
1 parent 4fcfb51 commit 3dea915

File tree

85 files changed

+4184
-1130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+4184
-1130
lines changed

src/ACL/ACLAuthMethod.php

Lines changed: 38 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,50 +28,41 @@
2828
class ACLAuthMethod extends AbstractModel
2929
{
3030
protected const FIELDS = [
31-
self::FIELD_DISPLAY_NAME => [
32-
Hydration::FIELD_TYPE => Hydration::STRING,
33-
Hydration::FIELD_NULLABLE => true,
34-
],
35-
self::FIELD_DESCRIPTION => [
36-
Hydration::FIELD_TYPE => Hydration::STRING,
37-
Hydration::FIELD_NULLABLE => true,
38-
],
31+
self::FIELD_DISPLAY_NAME => Hydration::OMITEMPTY_STRING_FIELD,
32+
self::FIELD_DESCRIPTION => Hydration::OMITEMPTY_STRING_FIELD,
3933
self::FIELD_MAX_TOKEN_TTL => [
40-
Hydration::FIELD_CALLBACK => Hydration::CALLABLE_HYDRATE_DURATION,
41-
],
42-
self::FIELD_TOKEN_LOCALITY => [
43-
Hydration::FIELD_TYPE => Hydration::STRING,
44-
Hydration::FIELD_NULLABLE => true,
34+
Hydration::FIELD_CALLBACK => Hydration::HYDRATE_DURATION,
35+
Hydration::FIELD_OMITEMPTY => true,
4536
],
37+
self::FIELD_TOKEN_LOCALITY => Hydration::OMITEMPTY_STRING_FIELD,
4638
self::FIELD_NAMESPACE_RULES => [
4739
Hydration::FIELD_TYPE => Hydration::ARRAY,
4840
Hydration::FIELD_CLASS => ACLAuthMethodNamespaceRule::class,
4941
Hydration::FIELD_ARRAY_TYPE => Hydration::class,
42+
Hydration::FIELD_OMITEMPTY => true,
5043
],
51-
self::FIELD_NAMESPACE => [
52-
Hydration::FIELD_TYPE => Hydration::STRING,
53-
Hydration::FIELD_NULLABLE => true,
54-
],
44+
self::FIELD_NAMESPACE => Hydration::OMITEMPTY_STRING_FIELD,
5545
];
56-
private const FIELD_DISPLAY_NAME = 'DisplayName';
57-
private const FIELD_DESCRIPTION = 'Description';
58-
private const FIELD_MAX_TOKEN_TTL = 'MaxTokenTTL';
59-
private const FIELD_TOKEN_LOCALITY = 'TokenLocality';
60-
private const FIELD_NAMESPACE_RULES = 'NamespaceRules';
61-
private const FIELD_NAMESPACE = 'Namespace';
46+
47+
private const FIELD_DISPLAY_NAME = 'DisplayName';
48+
private const FIELD_DESCRIPTION = 'Description';
49+
private const FIELD_MAX_TOKEN_TTL = 'MaxTokenTTL';
50+
private const FIELD_TOKEN_LOCALITY = 'TokenLocality';
51+
private const FIELD_NAMESPACE_RULES = 'NamespaceRules';
52+
private const FIELD_NAMESPACE = 'Namespace';
6253

6354
/** @var string */
6455
public string $Name = '';
6556
/** @var string */
6657
public string $Type = '';
67-
/** @var string|null */
68-
public ?string $DisplayName = null;
69-
/** @var string|null */
70-
public ?string $Description = null;
58+
/** @var string */
59+
public string $DisplayName = '';
60+
/** @var string */
61+
public string $Description = '';
7162
/** @var \DCarbone\Go\Time\Duration */
7263
public Time\Duration $MaxTokenTTL;
73-
/** @var string|null */
74-
public ?string $TokenLocality = null;
64+
/** @var string */
65+
public string $TokenLocality = '';
7566
/** @var array */
7667
public array $config = [];
7768
/** @var int */
@@ -80,8 +71,8 @@ class ACLAuthMethod extends AbstractModel
8071
public int $ModifyIndex = 0;
8172
/** @var \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodNamespaceRule[] */
8273
public array $NamespaceRules = [];
83-
/** @var string|null */
84-
public ?string $Namespace = null;
74+
/** @var string */
75+
public string $Namespace = '';
8576

8677
/**
8778
* ACLAuthMethod constructor.
@@ -132,36 +123,36 @@ public function setType(string $Type): self
132123
}
133124

134125
/**
135-
* @return string|null
126+
* @return string
136127
*/
137-
public function getDisplayName(): ?string
128+
public function getDisplayName(): string
138129
{
139130
return $this->DisplayName;
140131
}
141132

142133
/**
143-
* @param string|null $DisplayName
134+
* @param string $DisplayName
144135
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
145136
*/
146-
public function setDisplayName(?string $DisplayName): self
137+
public function setDisplayName(string $DisplayName): self
147138
{
148139
$this->DisplayName = $DisplayName;
149140
return $this;
150141
}
151142

152143
/**
153-
* @return string|null
144+
* @return string
154145
*/
155-
public function getDescription(): ?string
146+
public function getDescription(): string
156147
{
157148
return $this->Description;
158149
}
159150

160151
/**
161-
* @param string|null $Description
152+
* @param string $Description
162153
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
163154
*/
164-
public function setDescription(?string $Description): self
155+
public function setDescription(string $Description): self
165156
{
166157
$this->Description = $Description;
167158
return $this;
@@ -186,18 +177,18 @@ public function setMaxTokenTTL(Time\Duration $MaxTokenTTL): self
186177
}
187178

188179
/**
189-
* @return string|null
180+
* @return string
190181
*/
191-
public function getTokenLocality(): ?string
182+
public function getTokenLocality(): string
192183
{
193184
return $this->TokenLocality;
194185
}
195186

196187
/**
197-
* @param string|null $TokenLocality
188+
* @param string $TokenLocality
198189
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
199190
*/
200-
public function setTokenLocality(?string $TokenLocality): self
191+
public function setTokenLocality(string $TokenLocality): self
201192
{
202193
$this->TokenLocality = $TokenLocality;
203194
return $this;
@@ -276,18 +267,18 @@ public function setNamespaceRules(array $NamespaceRules): self
276267
}
277268

278269
/**
279-
* @return string|null
270+
* @return string
280271
*/
281-
public function getNamespace(): ?string
272+
public function getNamespace(): string
282273
{
283274
return $this->Namespace;
284275
}
285276

286277
/**
287-
* @param string|null $Namespace
278+
* @param string $Namespace
288279
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
289280
*/
290-
public function setNamespace(?string $Namespace): self
281+
public function setNamespace(string $Namespace): self
291282
{
292283
$this->Namespace = $Namespace;
293284
return $this;

src/ACL/ACLAuthMethodListEntry.php

Lines changed: 89 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,29 @@
2727
class ACLAuthMethodListEntry extends AbstractModel
2828
{
2929
protected const FIELDS = [
30-
self::FIELD_DISPLAY_NAME => [
31-
Hydration::FIELD_TYPE => Hydration::STRING,
32-
Hydration::FIELD_NULLABLE => true,
33-
],
34-
self::FIELD_DESCRIPTION => [
35-
Hydration::FIELD_TYPE => Hydration::STRING,
36-
Hydration::FIELD_NULLABLE => true,
37-
],
38-
self::FIELD_NAMESPACE => [
39-
Hydration::FIELD_TYPE => Hydration::STRING,
40-
Hydration::FIELD_NULLABLE => true,
41-
],
30+
self::FIELD_DISPLAY_NAME => Hydration::OMITEMPTY_STRING_FIELD,
31+
self::FIELD_DESCRIPTION => Hydration::OMITEMPTY_STRING_FIELD,
32+
self::FIELD_NAMESPACE => Hydration::OMITEMPTY_STRING_FIELD,
4233
];
43-
private const FIELD_DISPLAY_NAME = 'DisplayName';
44-
private const FIELD_DESCRIPTION = 'Description';
45-
private const FIELD_NAMESPACE = 'Namespace';
34+
35+
private const FIELD_DISPLAY_NAME = 'DisplayName';
36+
private const FIELD_DESCRIPTION = 'Description';
37+
private const FIELD_NAMESPACE = 'Namespace';
4638

4739
/** @var string */
4840
public string $Name = '';
4941
/** @var string */
5042
public string $Type = '';
51-
/** @var string|null */
52-
public ?string $DisplayName = null;
53-
/** @var string|null */
54-
public ?string $Description = null;
43+
/** @var string */
44+
public string $DisplayName = '';
45+
/** @var string */
46+
public string $Description = '';
5547
/** @var int */
5648
public int $CreateIndex = 0;
5749
/** @var int */
5850
public int $ModifyIndex = 0;
59-
/** @var string|null */
60-
public ?string $Namespace = null;
51+
/** @var string */
52+
public string $Namespace = '';
6153

6254
/**
6355
* @return string
@@ -67,6 +59,16 @@ public function getName(): string
6759
return $this->Name;
6860
}
6961

62+
/**
63+
* @param string $Name
64+
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
65+
*/
66+
public function setName(string $Name): self
67+
{
68+
$this->Name = $Name;
69+
return $this;
70+
}
71+
7072
/**
7173
* @return string
7274
*/
@@ -76,21 +78,51 @@ public function getType(): string
7678
}
7779

7880
/**
79-
* @return string|null
81+
* @param string $Type
82+
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
8083
*/
81-
public function getDisplayName(): ?string
84+
public function setType(string $Type): self
85+
{
86+
$this->Type = $Type;
87+
return $this;
88+
}
89+
90+
/**
91+
* @return string
92+
*/
93+
public function getDisplayName(): string
8294
{
8395
return $this->DisplayName;
8496
}
8597

8698
/**
87-
* @return string|null
99+
* @param string $DisplayName
100+
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
101+
*/
102+
public function setDisplayName(string $DisplayName): self
103+
{
104+
$this->DisplayName = $DisplayName;
105+
return $this;
106+
}
107+
108+
/**
109+
* @return string
88110
*/
89-
public function getDescription(): ?string
111+
public function getDescription(): string
90112
{
91113
return $this->Description;
92114
}
93115

116+
/**
117+
* @param string $Description
118+
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
119+
*/
120+
public function setDescription(string $Description): self
121+
{
122+
$this->Description = $Description;
123+
return $this;
124+
}
125+
94126
/**
95127
* @return int
96128
*/
@@ -99,6 +131,16 @@ public function getCreateIndex(): int
99131
return $this->CreateIndex;
100132
}
101133

134+
/**
135+
* @param int $CreateIndex
136+
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
137+
*/
138+
public function setCreateIndex(int $CreateIndex): self
139+
{
140+
$this->CreateIndex = $CreateIndex;
141+
return $this;
142+
}
143+
102144
/**
103145
* @return int
104146
*/
@@ -108,10 +150,30 @@ public function getModifyIndex(): int
108150
}
109151

110152
/**
111-
* @return string|null
153+
* @param int $ModifyIndex
154+
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
112155
*/
113-
public function getNamespace(): ?string
156+
public function setModifyIndex(int $ModifyIndex): self
157+
{
158+
$this->ModifyIndex = $ModifyIndex;
159+
return $this;
160+
}
161+
162+
/**
163+
* @return string
164+
*/
165+
public function getNamespace(): string
114166
{
115167
return $this->Namespace;
116168
}
169+
170+
/**
171+
* @param string $Namespace
172+
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
173+
*/
174+
public function setNamespace(string $Namespace): self
175+
{
176+
$this->Namespace = $Namespace;
177+
return $this;
178+
}
117179
}

0 commit comments

Comments
 (0)