|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Swaggest\JsonSchema; |
|
4
|
|
|
|
|
5
|
|
|
use Swaggest\JsonSchema\Constraint\Properties; |
|
6
|
|
|
use Swaggest\JsonSchema\Structure\SchemaStructure; |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
class JsonSchema extends SchemaStructure { |
|
10
|
|
|
/** @var string */ |
|
11
|
|
|
public $id; |
|
12
|
|
|
|
|
13
|
|
|
/** @var string */ |
|
14
|
|
|
public $schema; |
|
15
|
|
|
|
|
16
|
|
|
/** @var string */ |
|
17
|
|
|
public $title; |
|
18
|
|
|
|
|
19
|
|
|
/** @var string */ |
|
20
|
|
|
public $description; |
|
21
|
|
|
|
|
22
|
|
|
public $default; |
|
23
|
|
|
|
|
24
|
|
|
/** @var float */ |
|
25
|
|
|
public $multipleOf; |
|
26
|
|
|
|
|
27
|
|
|
/** @var float */ |
|
28
|
|
|
public $maximum; |
|
29
|
|
|
|
|
30
|
|
|
/** @var bool */ |
|
31
|
|
|
public $exclusiveMaximum; |
|
32
|
|
|
|
|
33
|
|
|
/** @var float */ |
|
34
|
|
|
public $minimum; |
|
35
|
|
|
|
|
36
|
|
|
/** @var bool */ |
|
37
|
|
|
public $exclusiveMinimum; |
|
38
|
|
|
|
|
39
|
|
|
/** @var int */ |
|
40
|
|
|
public $maxLength; |
|
41
|
|
|
|
|
42
|
|
|
/** @var int */ |
|
43
|
|
|
public $minLength; |
|
44
|
|
|
|
|
45
|
|
|
/** @var string */ |
|
46
|
|
|
public $pattern; |
|
47
|
|
|
|
|
48
|
|
|
/** @var bool|JsonSchema */ |
|
49
|
|
|
public $additionalItems; |
|
50
|
|
|
|
|
51
|
|
|
/** @var JsonSchema|JsonSchema[]|array */ |
|
52
|
|
|
public $items; |
|
53
|
|
|
|
|
54
|
|
|
/** @var int */ |
|
55
|
|
|
public $maxItems; |
|
56
|
|
|
|
|
57
|
|
|
/** @var int */ |
|
58
|
|
|
public $minItems; |
|
59
|
|
|
|
|
60
|
|
|
/** @var bool */ |
|
61
|
|
|
public $uniqueItems; |
|
62
|
|
|
|
|
63
|
|
|
/** @var int */ |
|
64
|
|
|
public $maxProperties; |
|
65
|
|
|
|
|
66
|
|
|
/** @var int */ |
|
67
|
|
|
public $minProperties; |
|
68
|
|
|
|
|
69
|
|
|
/** @var string[]|array */ |
|
70
|
|
|
public $required; |
|
71
|
|
|
|
|
72
|
|
|
/** @var bool|JsonSchema */ |
|
73
|
|
|
public $additionalProperties; |
|
74
|
|
|
|
|
75
|
|
|
/** @var JsonSchema[] */ |
|
76
|
|
|
public $definitions; |
|
77
|
|
|
|
|
78
|
|
|
/** @var JsonSchema|JsonSchema[] */ |
|
79
|
|
|
public $properties; |
|
80
|
|
|
|
|
81
|
|
|
/** @var JsonSchema[] */ |
|
82
|
|
|
public $patternProperties; |
|
83
|
|
|
|
|
84
|
|
|
/** @var JsonSchema[]|string[][]|array[] */ |
|
85
|
|
|
public $dependencies; |
|
86
|
|
|
|
|
87
|
|
|
/** @var array */ |
|
88
|
|
|
public $enum; |
|
89
|
|
|
|
|
90
|
|
|
/** @var array */ |
|
91
|
|
|
public $type; |
|
92
|
|
|
|
|
93
|
|
|
/** @var string */ |
|
94
|
|
|
public $format; |
|
95
|
|
|
|
|
96
|
|
|
/** @var string */ |
|
97
|
|
|
public $ref; |
|
98
|
|
|
|
|
99
|
|
|
/** @var JsonSchema[]|array */ |
|
100
|
|
|
public $allOf; |
|
101
|
|
|
|
|
102
|
|
|
/** @var JsonSchema[]|array */ |
|
103
|
|
|
public $anyOf; |
|
104
|
|
|
|
|
105
|
|
|
/** @var JsonSchema[]|array */ |
|
106
|
|
|
public $oneOf; |
|
107
|
|
|
|
|
108
|
|
|
/** @var JsonSchema */ |
|
109
|
|
|
public $not; |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @param Properties|static $properties |
|
113
|
|
|
* @param Schema $ownerSchema |
|
114
|
|
|
*/ |
|
115
|
|
|
public static function setUpProperties($properties, Schema $ownerSchema) |
|
116
|
|
|
{ |
|
117
|
|
|
$properties->id = JsonSchema::string(); |
|
118
|
|
|
$properties->schema = JsonSchema::string(); |
|
119
|
|
|
$ownerSchema->addPropertyMapping('$schema', self::names()->schema); |
|
|
|
|
|
|
120
|
|
|
$properties->title = JsonSchema::string(); |
|
121
|
|
|
$properties->description = JsonSchema::string(); |
|
122
|
|
|
$properties->default = new Schema(); |
|
123
|
|
|
$properties->multipleOf = JsonSchema::number(); |
|
124
|
|
|
$properties->multipleOf->minimum = 0; |
|
|
|
|
|
|
125
|
|
|
$properties->multipleOf->exclusiveMinimum = true; |
|
126
|
|
|
$properties->maximum = JsonSchema::number(); |
|
127
|
|
|
$properties->exclusiveMaximum = JsonSchema::boolean(); |
|
128
|
|
|
$properties->minimum = JsonSchema::number(); |
|
129
|
|
|
$properties->exclusiveMinimum = JsonSchema::boolean(); |
|
130
|
|
|
$properties->maxLength = JsonSchema::integer(); |
|
131
|
|
|
$properties->maxLength->minimum = 0; |
|
132
|
|
|
$properties->minLength = new Schema(); |
|
133
|
|
|
$properties->minLength->allOf[0] = JsonSchema::integer(); |
|
134
|
|
|
$properties->minLength->allOf[0]->minimum = 0; |
|
135
|
|
|
$properties->minLength->allOf[1] = new Schema(); |
|
136
|
|
|
$properties->pattern = JsonSchema::string(); |
|
137
|
|
|
$properties->additionalItems = new Schema(); |
|
138
|
|
|
$properties->additionalItems->anyOf[0] = JsonSchema::boolean(); |
|
139
|
|
|
$properties->additionalItems->anyOf[1] = JsonSchema::schema(); |
|
140
|
|
|
$properties->items = new Schema(); |
|
141
|
|
|
$properties->items->anyOf[0] = JsonSchema::schema(); |
|
142
|
|
|
$properties->items->anyOf[1] = JsonSchema::arr(); |
|
143
|
|
|
$properties->items->anyOf[1]->items = JsonSchema::schema(); |
|
|
|
|
|
|
144
|
|
|
$properties->items->anyOf[1]->minItems = 1; |
|
145
|
|
|
$properties->maxItems = JsonSchema::integer(); |
|
146
|
|
|
$properties->maxItems->minimum = 0; |
|
147
|
|
|
$properties->minItems = new Schema(); |
|
148
|
|
|
$properties->minItems->allOf[0] = JsonSchema::integer(); |
|
149
|
|
|
$properties->minItems->allOf[0]->minimum = 0; |
|
150
|
|
|
$properties->minItems->allOf[1] = new Schema(); |
|
151
|
|
|
$properties->uniqueItems = JsonSchema::boolean(); |
|
152
|
|
|
$properties->maxProperties = JsonSchema::integer(); |
|
153
|
|
|
$properties->maxProperties->minimum = 0; |
|
154
|
|
|
$properties->minProperties = new Schema(); |
|
155
|
|
|
$properties->minProperties->allOf[0] = JsonSchema::integer(); |
|
156
|
|
|
$properties->minProperties->allOf[0]->minimum = 0; |
|
157
|
|
|
$properties->minProperties->allOf[1] = new Schema(); |
|
158
|
|
|
$properties->required = JsonSchema::arr(); |
|
159
|
|
|
$properties->required->items = JsonSchema::string(); |
|
160
|
|
|
$properties->required->uniqueItems = true; |
|
161
|
|
|
$properties->required->minItems = 1; |
|
162
|
|
|
$properties->additionalProperties = new Schema(); |
|
163
|
|
|
$properties->additionalProperties->anyOf[0] = JsonSchema::boolean(); |
|
164
|
|
|
$properties->additionalProperties->anyOf[1] = JsonSchema::schema(); |
|
165
|
|
|
$properties->definitions = JsonSchema::object(); |
|
166
|
|
|
$properties->definitions->additionalProperties = JsonSchema::schema(); |
|
|
|
|
|
|
167
|
|
|
$properties->properties = JsonSchema::object(); |
|
168
|
|
|
$properties->properties->additionalProperties = JsonSchema::schema(); |
|
169
|
|
|
$properties->patternProperties = JsonSchema::object(); |
|
170
|
|
|
$properties->patternProperties->additionalProperties = JsonSchema::schema(); |
|
171
|
|
|
$properties->dependencies = JsonSchema::object(); |
|
172
|
|
|
//$properties->dependencies->additionalProperties = JsonSchema::schema(); |
|
|
|
|
|
|
173
|
|
|
$properties->dependencies->additionalProperties = new Schema(); |
|
|
|
|
|
|
174
|
|
|
$properties->dependencies->additionalProperties->anyOf[0] = JsonSchema::schema(); |
|
175
|
|
|
$properties->dependencies->additionalProperties->anyOf[1] = JsonSchema::arr(); |
|
176
|
|
|
$properties->dependencies->additionalProperties->anyOf[1]->items = JsonSchema::string(); |
|
177
|
|
|
$properties->dependencies->additionalProperties->anyOf[1]->uniqueItems = true; |
|
178
|
|
|
$properties->dependencies->additionalProperties->anyOf[1]->minItems = 1; |
|
179
|
|
|
$properties->enum = JsonSchema::arr(); |
|
180
|
|
|
$properties->enum->uniqueItems = true; |
|
181
|
|
|
$properties->enum->minItems = 1; |
|
182
|
|
|
$properties->type = new Schema(); |
|
183
|
|
|
$properties->type->anyOf[0] = new Schema(); |
|
184
|
|
|
$properties->type->anyOf[0]->enum = array ( |
|
185
|
|
|
0 => 'array', |
|
186
|
|
|
1 => 'boolean', |
|
187
|
|
|
2 => 'integer', |
|
188
|
|
|
3 => 'null', |
|
189
|
|
|
4 => 'number', |
|
190
|
|
|
5 => 'object', |
|
191
|
|
|
6 => 'string', |
|
192
|
|
|
); |
|
193
|
|
|
$properties->type->anyOf[1] = JsonSchema::arr(); |
|
194
|
|
|
$properties->type->anyOf[1]->items = new Schema(); |
|
|
|
|
|
|
195
|
|
|
$properties->type->anyOf[1]->items->enum = array ( |
|
196
|
|
|
0 => 'array', |
|
197
|
|
|
1 => 'boolean', |
|
198
|
|
|
2 => 'integer', |
|
199
|
|
|
3 => 'null', |
|
200
|
|
|
4 => 'number', |
|
201
|
|
|
5 => 'object', |
|
202
|
|
|
6 => 'string', |
|
203
|
|
|
); |
|
204
|
|
|
$properties->type->anyOf[1]->uniqueItems = true; |
|
205
|
|
|
$properties->type->anyOf[1]->minItems = 1; |
|
206
|
|
|
$properties->format = JsonSchema::string(); |
|
207
|
|
|
$properties->ref = JsonSchema::string(); |
|
208
|
|
|
$ownerSchema->addPropertyMapping('$ref', self::names()->ref); |
|
|
|
|
|
|
209
|
|
|
$properties->allOf = JsonSchema::arr(); |
|
210
|
|
|
$properties->allOf->items = JsonSchema::schema(); |
|
211
|
|
|
$properties->allOf->minItems = 1; |
|
212
|
|
|
$properties->anyOf = JsonSchema::arr(); |
|
213
|
|
|
$properties->anyOf->items = JsonSchema::schema(); |
|
214
|
|
|
$properties->anyOf->minItems = 1; |
|
215
|
|
|
$properties->oneOf = JsonSchema::arr(); |
|
216
|
|
|
$properties->oneOf->items = JsonSchema::schema(); |
|
217
|
|
|
$properties->oneOf->minItems = 1; |
|
218
|
|
|
$properties->not = JsonSchema::schema(); |
|
219
|
|
|
$ownerSchema->type = 'object'; |
|
|
|
|
|
|
220
|
|
|
$ownerSchema->dependencies = array ( |
|
|
|
|
|
|
221
|
|
|
'exclusiveMaximum' => |
|
222
|
|
|
array ( |
|
223
|
|
|
0 => 'maximum', |
|
224
|
|
|
), |
|
225
|
|
|
'exclusiveMinimum' => |
|
226
|
|
|
array ( |
|
227
|
|
|
0 => 'minimum', |
|
228
|
|
|
), |
|
229
|
|
|
); |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
/** |
|
233
|
|
|
* @return string |
|
234
|
|
|
*/ |
|
235
|
|
|
public function getId() |
|
236
|
|
|
{ |
|
237
|
|
|
return $this->id; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* @param string $id |
|
242
|
|
|
* @return $this |
|
243
|
|
|
*/ |
|
244
|
|
|
public function setId($id) |
|
245
|
|
|
{ |
|
246
|
|
|
$this->id = $id; |
|
247
|
|
|
return $this; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @return string |
|
252
|
|
|
*/ |
|
253
|
|
|
public function getSchema() |
|
254
|
|
|
{ |
|
255
|
|
|
return $this->schema; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* @param string $schema |
|
260
|
|
|
* @return $this |
|
261
|
|
|
*/ |
|
262
|
|
|
public function setSchema($schema) |
|
263
|
|
|
{ |
|
264
|
|
|
$this->schema = $schema; |
|
265
|
|
|
return $this; |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* @return string |
|
270
|
|
|
*/ |
|
271
|
|
|
public function getTitle() |
|
272
|
|
|
{ |
|
273
|
|
|
return $this->title; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @param string $title |
|
278
|
|
|
* @return $this |
|
279
|
|
|
*/ |
|
280
|
|
|
public function setTitle($title) |
|
281
|
|
|
{ |
|
282
|
|
|
$this->title = $title; |
|
283
|
|
|
return $this; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @return string |
|
288
|
|
|
*/ |
|
289
|
|
|
public function getDescription() |
|
290
|
|
|
{ |
|
291
|
|
|
return $this->description; |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
/** |
|
295
|
|
|
* @param string $description |
|
296
|
|
|
* @return $this |
|
297
|
|
|
*/ |
|
298
|
|
|
public function setDescription($description) |
|
299
|
|
|
{ |
|
300
|
|
|
$this->description = $description; |
|
301
|
|
|
return $this; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
public function getDefault() |
|
305
|
|
|
{ |
|
306
|
|
|
return $this->default; |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
/** |
|
310
|
|
|
* @param $default |
|
311
|
|
|
* @return $this |
|
312
|
|
|
*/ |
|
313
|
|
|
public function setDefault($default) |
|
314
|
|
|
{ |
|
315
|
|
|
$this->default = $default; |
|
316
|
|
|
return $this; |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
/** |
|
320
|
|
|
* @return float |
|
321
|
|
|
*/ |
|
322
|
|
|
public function getMultipleOf() |
|
323
|
|
|
{ |
|
324
|
|
|
return $this->multipleOf; |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* @param float $multipleOf |
|
329
|
|
|
* @return $this |
|
330
|
|
|
*/ |
|
331
|
|
|
public function setMultipleOf($multipleOf) |
|
332
|
|
|
{ |
|
333
|
|
|
$this->multipleOf = $multipleOf; |
|
334
|
|
|
return $this; |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
/** |
|
338
|
|
|
* @return float |
|
339
|
|
|
*/ |
|
340
|
|
|
public function getMaximum() |
|
341
|
|
|
{ |
|
342
|
|
|
return $this->maximum; |
|
343
|
|
|
} |
|
344
|
|
|
|
|
345
|
|
|
/** |
|
346
|
|
|
* @param float $maximum |
|
347
|
|
|
* @return $this |
|
348
|
|
|
*/ |
|
349
|
|
|
public function setMaximum($maximum) |
|
350
|
|
|
{ |
|
351
|
|
|
$this->maximum = $maximum; |
|
352
|
|
|
return $this; |
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
/** |
|
356
|
|
|
* @return bool |
|
357
|
|
|
*/ |
|
358
|
|
|
public function getExclusiveMaximum() |
|
359
|
|
|
{ |
|
360
|
|
|
return $this->exclusiveMaximum; |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
|
|
/** |
|
364
|
|
|
* @param bool $exclusiveMaximum |
|
365
|
|
|
* @return $this |
|
366
|
|
|
*/ |
|
367
|
|
|
public function setExclusiveMaximum($exclusiveMaximum) |
|
368
|
|
|
{ |
|
369
|
|
|
$this->exclusiveMaximum = $exclusiveMaximum; |
|
370
|
|
|
return $this; |
|
371
|
|
|
} |
|
372
|
|
|
|
|
373
|
|
|
/** |
|
374
|
|
|
* @return float |
|
375
|
|
|
*/ |
|
376
|
|
|
public function getMinimum() |
|
377
|
|
|
{ |
|
378
|
|
|
return $this->minimum; |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
/** |
|
382
|
|
|
* @param float $minimum |
|
383
|
|
|
* @return $this |
|
384
|
|
|
*/ |
|
385
|
|
|
public function setMinimum($minimum) |
|
386
|
|
|
{ |
|
387
|
|
|
$this->minimum = $minimum; |
|
388
|
|
|
return $this; |
|
389
|
|
|
} |
|
390
|
|
|
|
|
391
|
|
|
/** |
|
392
|
|
|
* @return bool |
|
393
|
|
|
*/ |
|
394
|
|
|
public function getExclusiveMinimum() |
|
395
|
|
|
{ |
|
396
|
|
|
return $this->exclusiveMinimum; |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
/** |
|
400
|
|
|
* @param bool $exclusiveMinimum |
|
401
|
|
|
* @return $this |
|
402
|
|
|
*/ |
|
403
|
|
|
public function setExclusiveMinimum($exclusiveMinimum) |
|
404
|
|
|
{ |
|
405
|
|
|
$this->exclusiveMinimum = $exclusiveMinimum; |
|
406
|
|
|
return $this; |
|
407
|
|
|
} |
|
408
|
|
|
|
|
409
|
|
|
/** |
|
410
|
|
|
* @return int |
|
411
|
|
|
*/ |
|
412
|
|
|
public function getMaxLength() |
|
413
|
|
|
{ |
|
414
|
|
|
return $this->maxLength; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
/** |
|
418
|
|
|
* @param int $maxLength |
|
419
|
|
|
* @return $this |
|
420
|
|
|
*/ |
|
421
|
|
|
public function setMaxLength($maxLength) |
|
422
|
|
|
{ |
|
423
|
|
|
$this->maxLength = $maxLength; |
|
424
|
|
|
return $this; |
|
425
|
|
|
} |
|
426
|
|
|
|
|
427
|
|
|
/** |
|
428
|
|
|
* @return int |
|
429
|
|
|
*/ |
|
430
|
|
|
public function getMinLength() |
|
431
|
|
|
{ |
|
432
|
|
|
return $this->minLength; |
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
/** |
|
436
|
|
|
* @param int $minLength |
|
437
|
|
|
* @return $this |
|
438
|
|
|
*/ |
|
439
|
|
|
public function setMinLength($minLength) |
|
440
|
|
|
{ |
|
441
|
|
|
$this->minLength = $minLength; |
|
442
|
|
|
return $this; |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
/** |
|
446
|
|
|
* @return string |
|
447
|
|
|
*/ |
|
448
|
|
|
public function getPattern() |
|
449
|
|
|
{ |
|
450
|
|
|
return $this->pattern; |
|
451
|
|
|
} |
|
452
|
|
|
|
|
453
|
|
|
/** |
|
454
|
|
|
* @param string $pattern |
|
455
|
|
|
* @return $this |
|
456
|
|
|
*/ |
|
457
|
|
|
public function setPattern($pattern) |
|
458
|
|
|
{ |
|
459
|
|
|
$this->pattern = $pattern; |
|
460
|
|
|
return $this; |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
/** |
|
464
|
|
|
* @return bool|JsonSchema |
|
465
|
|
|
*/ |
|
466
|
|
|
public function getAdditionalItems() |
|
467
|
|
|
{ |
|
468
|
|
|
return $this->additionalItems; |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
/** |
|
472
|
|
|
* @param bool|JsonSchema $additionalItems |
|
473
|
|
|
* @return $this |
|
474
|
|
|
*/ |
|
475
|
|
|
public function setAdditionalItems($additionalItems) |
|
476
|
|
|
{ |
|
477
|
|
|
$this->additionalItems = $additionalItems; |
|
478
|
|
|
return $this; |
|
479
|
|
|
} |
|
480
|
|
|
|
|
481
|
|
|
/** |
|
482
|
|
|
* @return JsonSchema|JsonSchema[]|array |
|
483
|
|
|
*/ |
|
484
|
|
|
public function getItems() |
|
485
|
|
|
{ |
|
486
|
|
|
return $this->items; |
|
487
|
|
|
} |
|
488
|
|
|
|
|
489
|
|
|
/** |
|
490
|
|
|
* @param JsonSchema|JsonSchema[]|array $items |
|
491
|
|
|
* @return $this |
|
492
|
|
|
*/ |
|
493
|
|
|
public function setItems($items) |
|
494
|
|
|
{ |
|
495
|
|
|
$this->items = $items; |
|
496
|
|
|
return $this; |
|
497
|
|
|
} |
|
498
|
|
|
|
|
499
|
|
|
/** |
|
500
|
|
|
* @return int |
|
501
|
|
|
*/ |
|
502
|
|
|
public function getMaxItems() |
|
503
|
|
|
{ |
|
504
|
|
|
return $this->maxItems; |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
/** |
|
508
|
|
|
* @param int $maxItems |
|
509
|
|
|
* @return $this |
|
510
|
|
|
*/ |
|
511
|
|
|
public function setMaxItems($maxItems) |
|
512
|
|
|
{ |
|
513
|
|
|
$this->maxItems = $maxItems; |
|
514
|
|
|
return $this; |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
/** |
|
518
|
|
|
* @return int |
|
519
|
|
|
*/ |
|
520
|
|
|
public function getMinItems() |
|
521
|
|
|
{ |
|
522
|
|
|
return $this->minItems; |
|
523
|
|
|
} |
|
524
|
|
|
|
|
525
|
|
|
/** |
|
526
|
|
|
* @param int $minItems |
|
527
|
|
|
* @return $this |
|
528
|
|
|
*/ |
|
529
|
|
|
public function setMinItems($minItems) |
|
530
|
|
|
{ |
|
531
|
|
|
$this->minItems = $minItems; |
|
532
|
|
|
return $this; |
|
533
|
|
|
} |
|
534
|
|
|
|
|
535
|
|
|
/** |
|
536
|
|
|
* @return bool |
|
537
|
|
|
*/ |
|
538
|
|
|
public function getUniqueItems() |
|
539
|
|
|
{ |
|
540
|
|
|
return $this->uniqueItems; |
|
541
|
|
|
} |
|
542
|
|
|
|
|
543
|
|
|
/** |
|
544
|
|
|
* @param bool $uniqueItems |
|
545
|
|
|
* @return $this |
|
546
|
|
|
*/ |
|
547
|
|
|
public function setUniqueItems($uniqueItems) |
|
548
|
|
|
{ |
|
549
|
|
|
$this->uniqueItems = $uniqueItems; |
|
550
|
|
|
return $this; |
|
551
|
|
|
} |
|
552
|
|
|
|
|
553
|
|
|
/** |
|
554
|
|
|
* @return int |
|
555
|
|
|
*/ |
|
556
|
|
|
public function getMaxProperties() |
|
557
|
|
|
{ |
|
558
|
|
|
return $this->maxProperties; |
|
559
|
|
|
} |
|
560
|
|
|
|
|
561
|
|
|
/** |
|
562
|
|
|
* @param int $maxProperties |
|
563
|
|
|
* @return $this |
|
564
|
|
|
*/ |
|
565
|
|
|
public function setMaxProperties($maxProperties) |
|
566
|
|
|
{ |
|
567
|
|
|
$this->maxProperties = $maxProperties; |
|
568
|
|
|
return $this; |
|
569
|
|
|
} |
|
570
|
|
|
|
|
571
|
|
|
/** |
|
572
|
|
|
* @return int |
|
573
|
|
|
*/ |
|
574
|
|
|
public function getMinProperties() |
|
575
|
|
|
{ |
|
576
|
|
|
return $this->minProperties; |
|
577
|
|
|
} |
|
578
|
|
|
|
|
579
|
|
|
/** |
|
580
|
|
|
* @param int $minProperties |
|
581
|
|
|
* @return $this |
|
582
|
|
|
*/ |
|
583
|
|
|
public function setMinProperties($minProperties) |
|
584
|
|
|
{ |
|
585
|
|
|
$this->minProperties = $minProperties; |
|
586
|
|
|
return $this; |
|
587
|
|
|
} |
|
588
|
|
|
|
|
589
|
|
|
/** |
|
590
|
|
|
* @return string[]|array |
|
591
|
|
|
*/ |
|
592
|
|
|
public function getRequired() |
|
593
|
|
|
{ |
|
594
|
|
|
return $this->required; |
|
595
|
|
|
} |
|
596
|
|
|
|
|
597
|
|
|
/** |
|
598
|
|
|
* @param string[]|array $required |
|
599
|
|
|
* @return $this |
|
600
|
|
|
*/ |
|
601
|
|
|
public function setRequired($required) |
|
602
|
|
|
{ |
|
603
|
|
|
$this->required = $required; |
|
604
|
|
|
return $this; |
|
605
|
|
|
} |
|
606
|
|
|
|
|
607
|
|
|
/** |
|
608
|
|
|
* @return bool|JsonSchema |
|
609
|
|
|
*/ |
|
610
|
|
|
public function getAdditionalProperties() |
|
611
|
|
|
{ |
|
612
|
|
|
return $this->additionalProperties; |
|
613
|
|
|
} |
|
614
|
|
|
|
|
615
|
|
|
/** |
|
616
|
|
|
* @param bool|JsonSchema $additionalProperties |
|
617
|
|
|
* @return $this |
|
618
|
|
|
*/ |
|
619
|
|
|
public function setAdditionalProperties($additionalProperties) |
|
620
|
|
|
{ |
|
621
|
|
|
$this->additionalProperties = $additionalProperties; |
|
622
|
|
|
return $this; |
|
623
|
|
|
} |
|
624
|
|
|
|
|
625
|
|
|
/** |
|
626
|
|
|
* @return JsonSchema[] |
|
627
|
|
|
*/ |
|
628
|
|
|
public function getDefinitions() |
|
629
|
|
|
{ |
|
630
|
|
|
return $this->definitions; |
|
631
|
|
|
} |
|
632
|
|
|
|
|
633
|
|
|
/** |
|
634
|
|
|
* @param JsonSchema[] $definitions |
|
635
|
|
|
* @return $this |
|
636
|
|
|
*/ |
|
637
|
|
|
public function setDefinitions($definitions) |
|
638
|
|
|
{ |
|
639
|
|
|
$this->definitions = $definitions; |
|
640
|
|
|
return $this; |
|
641
|
|
|
} |
|
642
|
|
|
|
|
643
|
|
|
/** |
|
644
|
|
|
* @return JsonSchema[] |
|
645
|
|
|
*/ |
|
646
|
|
|
public function getProperties() |
|
647
|
|
|
{ |
|
648
|
|
|
return $this->properties; |
|
649
|
|
|
} |
|
650
|
|
|
|
|
651
|
|
|
/** |
|
652
|
|
|
* @param JsonSchema[] $properties |
|
653
|
|
|
* @return $this |
|
654
|
|
|
*/ |
|
655
|
|
|
public function setProperties($properties) |
|
656
|
|
|
{ |
|
657
|
|
|
$this->properties = $properties; |
|
658
|
|
|
return $this; |
|
659
|
|
|
} |
|
660
|
|
|
|
|
661
|
|
|
/** |
|
662
|
|
|
* @return JsonSchema[] |
|
663
|
|
|
*/ |
|
664
|
|
|
public function getPatternProperties() |
|
665
|
|
|
{ |
|
666
|
|
|
return $this->patternProperties; |
|
667
|
|
|
} |
|
668
|
|
|
|
|
669
|
|
|
/** |
|
670
|
|
|
* @param JsonSchema[] $patternProperties |
|
671
|
|
|
* @return $this |
|
672
|
|
|
*/ |
|
673
|
|
|
public function setPatternProperties($patternProperties) |
|
674
|
|
|
{ |
|
675
|
|
|
$this->patternProperties = $patternProperties; |
|
676
|
|
|
return $this; |
|
677
|
|
|
} |
|
678
|
|
|
|
|
679
|
|
|
/** |
|
680
|
|
|
* @return JsonSchema[]|string[][]|array[] |
|
681
|
|
|
*/ |
|
682
|
|
|
public function getDependencies() |
|
683
|
|
|
{ |
|
684
|
|
|
return $this->dependencies; |
|
685
|
|
|
} |
|
686
|
|
|
|
|
687
|
|
|
/** |
|
688
|
|
|
* @param JsonSchema[]|string[][]|array[] $dependencies |
|
689
|
|
|
* @return $this |
|
690
|
|
|
*/ |
|
691
|
|
|
public function setDependencies($dependencies) |
|
692
|
|
|
{ |
|
693
|
|
|
$this->dependencies = $dependencies; |
|
694
|
|
|
return $this; |
|
695
|
|
|
} |
|
696
|
|
|
|
|
697
|
|
|
/** |
|
698
|
|
|
* @return array |
|
699
|
|
|
*/ |
|
700
|
|
|
public function getEnum() |
|
701
|
|
|
{ |
|
702
|
|
|
return $this->enum; |
|
703
|
|
|
} |
|
704
|
|
|
|
|
705
|
|
|
/** |
|
706
|
|
|
* @param array $enum |
|
707
|
|
|
* @return $this |
|
708
|
|
|
*/ |
|
709
|
|
|
public function setEnum($enum) |
|
710
|
|
|
{ |
|
711
|
|
|
$this->enum = $enum; |
|
712
|
|
|
return $this; |
|
713
|
|
|
} |
|
714
|
|
|
|
|
715
|
|
|
/** |
|
716
|
|
|
* @return array |
|
717
|
|
|
*/ |
|
718
|
|
|
public function getType() |
|
719
|
|
|
{ |
|
720
|
|
|
return $this->type; |
|
721
|
|
|
} |
|
722
|
|
|
|
|
723
|
|
|
/** |
|
724
|
|
|
* @param array $type |
|
725
|
|
|
* @return $this |
|
726
|
|
|
*/ |
|
727
|
|
|
public function setType($type) |
|
728
|
|
|
{ |
|
729
|
|
|
$this->type = $type; |
|
730
|
|
|
return $this; |
|
731
|
|
|
} |
|
732
|
|
|
|
|
733
|
|
|
/** |
|
734
|
|
|
* @return string |
|
735
|
|
|
*/ |
|
736
|
|
|
public function getFormat() |
|
737
|
|
|
{ |
|
738
|
|
|
return $this->format; |
|
739
|
|
|
} |
|
740
|
|
|
|
|
741
|
|
|
/** |
|
742
|
|
|
* @param string $format |
|
743
|
|
|
* @return $this |
|
744
|
|
|
*/ |
|
745
|
|
|
public function setFormat($format) |
|
746
|
|
|
{ |
|
747
|
|
|
$this->format = $format; |
|
748
|
|
|
return $this; |
|
749
|
|
|
} |
|
750
|
|
|
|
|
751
|
|
|
/** |
|
752
|
|
|
* @return string |
|
753
|
|
|
*/ |
|
754
|
|
|
public function getRef() |
|
755
|
|
|
{ |
|
756
|
|
|
return $this->ref; |
|
757
|
|
|
} |
|
758
|
|
|
|
|
759
|
|
|
/** |
|
760
|
|
|
* @param string $ref |
|
761
|
|
|
* @return $this |
|
762
|
|
|
*/ |
|
763
|
|
|
public function setRef($ref) |
|
764
|
|
|
{ |
|
765
|
|
|
$this->ref = $ref; |
|
766
|
|
|
return $this; |
|
767
|
|
|
} |
|
768
|
|
|
|
|
769
|
|
|
/** |
|
770
|
|
|
* @return JsonSchema[]|array |
|
771
|
|
|
*/ |
|
772
|
|
|
public function getAllOf() |
|
773
|
|
|
{ |
|
774
|
|
|
return $this->allOf; |
|
775
|
|
|
} |
|
776
|
|
|
|
|
777
|
|
|
/** |
|
778
|
|
|
* @param JsonSchema[]|array $allOf |
|
779
|
|
|
* @return $this |
|
780
|
|
|
*/ |
|
781
|
|
|
public function setAllOf($allOf) |
|
782
|
|
|
{ |
|
783
|
|
|
$this->allOf = $allOf; |
|
784
|
|
|
return $this; |
|
785
|
|
|
} |
|
786
|
|
|
|
|
787
|
|
|
/** |
|
788
|
|
|
* @return JsonSchema[]|array |
|
789
|
|
|
*/ |
|
790
|
|
|
public function getAnyOf() |
|
791
|
|
|
{ |
|
792
|
|
|
return $this->anyOf; |
|
793
|
|
|
} |
|
794
|
|
|
|
|
795
|
|
|
/** |
|
796
|
|
|
* @param JsonSchema[]|array $anyOf |
|
797
|
|
|
* @return $this |
|
798
|
|
|
*/ |
|
799
|
|
|
public function setAnyOf($anyOf) |
|
800
|
|
|
{ |
|
801
|
|
|
$this->anyOf = $anyOf; |
|
802
|
|
|
return $this; |
|
803
|
|
|
} |
|
804
|
|
|
|
|
805
|
|
|
/** |
|
806
|
|
|
* @return JsonSchema[]|array |
|
807
|
|
|
*/ |
|
808
|
|
|
public function getOneOf() |
|
809
|
|
|
{ |
|
810
|
|
|
return $this->oneOf; |
|
811
|
|
|
} |
|
812
|
|
|
|
|
813
|
|
|
/** |
|
814
|
|
|
* @param JsonSchema[]|array $oneOf |
|
815
|
|
|
* @return $this |
|
816
|
|
|
*/ |
|
817
|
|
|
public function setOneOf($oneOf) |
|
818
|
|
|
{ |
|
819
|
|
|
$this->oneOf = $oneOf; |
|
820
|
|
|
return $this; |
|
821
|
|
|
} |
|
822
|
|
|
|
|
823
|
|
|
/** |
|
824
|
|
|
* @return JsonSchema |
|
825
|
|
|
*/ |
|
826
|
|
|
public function getNot() |
|
827
|
|
|
{ |
|
828
|
|
|
return $this->not; |
|
829
|
|
|
} |
|
830
|
|
|
|
|
831
|
|
|
/** |
|
832
|
|
|
* @param JsonSchema $not |
|
833
|
|
|
* @return $this |
|
834
|
|
|
*/ |
|
835
|
|
|
public function setNot($not) |
|
836
|
|
|
{ |
|
837
|
|
|
$this->not = $not; |
|
838
|
|
|
return $this; |
|
839
|
|
|
} |
|
840
|
|
|
} |
|
841
|
|
|
|
|
842
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.