1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @file ATTENTION!!! The code below was carefully crafted by a mean machine. |
4
|
|
|
* Please consider to NOT put any emotional human-generated modifications as the splendid AI will throw them away with no mercy. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace Swaggest\JsonSchema; |
8
|
|
|
|
9
|
|
|
use Swaggest\JsonSchema\Constraint\Format; |
10
|
|
|
use Swaggest\JsonSchema\Constraint\Properties; |
11
|
|
|
use Swaggest\JsonSchema\Constraint\Type; |
12
|
|
|
use Swaggest\JsonSchema\Schema as JsonBasicSchema; |
13
|
|
|
use Swaggest\JsonSchema\Structure\ClassStructure; |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Core schema meta-schema |
18
|
|
|
* |
19
|
|
|
* // draft6 |
20
|
|
|
* @property mixed $const |
21
|
|
|
* |
22
|
|
|
* @property mixed $default |
23
|
|
|
*/ |
24
|
|
|
class JsonSchema extends ClassStructure |
25
|
|
|
{ |
26
|
|
|
const _ARRAY = 'array'; |
27
|
|
|
|
28
|
|
|
const BOOLEAN = 'boolean'; |
29
|
|
|
|
30
|
|
|
const INTEGER = 'integer'; |
31
|
|
|
|
32
|
|
|
const NULL = 'null'; |
33
|
|
|
|
34
|
|
|
const NUMBER = 'number'; |
35
|
|
|
|
36
|
|
|
const OBJECT = 'object'; |
37
|
|
|
|
38
|
|
|
const STRING = 'string'; |
39
|
|
|
|
40
|
|
|
/** @var string */ |
41
|
|
|
public $id; |
42
|
|
|
|
43
|
|
|
/** @var string */ |
44
|
|
|
public $schema; |
45
|
|
|
|
46
|
|
|
/** @var string */ |
47
|
|
|
public $title; |
48
|
|
|
|
49
|
|
|
/** @var string */ |
50
|
|
|
public $description; |
51
|
|
|
|
52
|
|
|
/** @var float|null */ |
53
|
|
|
public $multipleOf; |
54
|
|
|
|
55
|
|
|
/** @var float|null */ |
56
|
|
|
public $maximum; |
57
|
|
|
|
58
|
|
|
/** @var bool|float|null */ |
59
|
|
|
public $exclusiveMaximum; |
60
|
|
|
|
61
|
|
|
/** @var float|null */ |
62
|
|
|
public $minimum; |
63
|
|
|
|
64
|
|
|
/** @var bool|float */ |
65
|
|
|
public $exclusiveMinimum; |
66
|
|
|
|
67
|
|
|
/** @var int|null */ |
68
|
|
|
public $maxLength; |
69
|
|
|
|
70
|
|
|
/** @var int|null */ |
71
|
|
|
public $minLength; |
72
|
|
|
|
73
|
|
|
/** @var string|null */ |
74
|
|
|
public $pattern; |
75
|
|
|
|
76
|
|
|
/** @var bool|JsonSchema */ |
77
|
|
|
public $additionalItems; |
78
|
|
|
|
79
|
|
|
/** @var JsonSchema|JsonSchema[]|array */ |
80
|
|
|
public $items; |
81
|
|
|
|
82
|
|
|
/** @var int|null */ |
83
|
|
|
public $maxItems; |
84
|
|
|
|
85
|
|
|
/** @var int|null */ |
86
|
|
|
public $minItems; |
87
|
|
|
|
88
|
|
|
/** @var bool|null */ |
89
|
|
|
public $uniqueItems; |
90
|
|
|
|
91
|
|
|
/** @var int */ |
92
|
|
|
public $maxProperties; |
93
|
|
|
|
94
|
|
|
/** @var int */ |
95
|
|
|
public $minProperties; |
96
|
|
|
|
97
|
|
|
/** @var string[]|array */ |
98
|
|
|
public $required; |
99
|
|
|
|
100
|
|
|
/** @var bool|JsonSchema */ |
101
|
|
|
public $additionalProperties; |
102
|
|
|
|
103
|
|
|
/** @var JsonSchema[] */ |
104
|
|
|
public $definitions; |
105
|
|
|
|
106
|
|
|
/** @var JsonSchema[] */ |
107
|
|
|
public $properties; |
108
|
|
|
|
109
|
|
|
/** @var JsonSchema[] */ |
110
|
|
|
public $patternProperties; |
111
|
|
|
|
112
|
|
|
/** @var JsonSchema[]|string[][]|array[] */ |
113
|
|
|
public $dependencies; |
114
|
|
|
|
115
|
|
|
/** @var array */ |
116
|
|
|
public $enum; |
117
|
|
|
|
118
|
|
|
/** @var array|string */ |
119
|
|
|
public $type; |
120
|
|
|
|
121
|
|
|
/** @var string|null */ |
122
|
|
|
public $format; |
123
|
|
|
|
124
|
|
|
/** @var string */ |
125
|
|
|
public $ref; |
126
|
|
|
|
127
|
|
|
/** @var JsonSchema[]|array */ |
128
|
|
|
public $allOf; |
129
|
|
|
|
130
|
|
|
/** @var JsonSchema[]|array */ |
131
|
|
|
public $anyOf; |
132
|
|
|
|
133
|
|
|
/** @var JsonSchema[]|array */ |
134
|
|
|
public $oneOf; |
135
|
|
|
|
136
|
|
|
/** @var JsonSchema Core schema meta-schema */ |
137
|
|
|
public $not; |
138
|
|
|
|
139
|
|
|
|
140
|
|
|
// draft6 |
141
|
|
|
/** @var JsonSchema */ |
142
|
|
|
public $contains; |
143
|
|
|
|
144
|
|
|
/** @var JsonSchema */ |
145
|
|
|
public $propertyNames; |
146
|
|
|
|
147
|
|
|
// draft7 |
148
|
|
|
/** @var JsonSchema */ |
149
|
|
|
public $if; |
150
|
|
|
|
151
|
|
|
/** @var JsonSchema */ |
152
|
|
|
public $then; |
153
|
|
|
|
154
|
|
|
/** @var JsonSchema */ |
155
|
|
|
public $else; |
156
|
|
|
|
157
|
|
|
/** @var string */ |
158
|
|
|
public $contentMediaType; |
159
|
|
|
|
160
|
|
|
/** @var string */ |
161
|
|
|
public $contentEncoding; |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param Properties|static $properties |
165
|
|
|
* @param JsonBasicSchema $ownerSchema |
166
|
1 |
|
*/ |
167
|
|
|
public static function setUpProperties($properties, JsonBasicSchema $ownerSchema) |
168
|
1 |
|
{ |
169
|
1 |
|
$properties->id = JsonBasicSchema::string(); |
|
|
|
|
170
|
1 |
|
$properties->id->format = 'uri'; |
|
|
|
|
171
|
1 |
|
$properties->schema = JsonBasicSchema::string(); |
|
|
|
|
172
|
1 |
|
$properties->schema->format = 'uri'; |
|
|
|
|
173
|
1 |
|
$ownerSchema->addPropertyMapping('$schema', self::names()->schema); |
|
|
|
|
174
|
1 |
|
$properties->title = JsonBasicSchema::string(); |
|
|
|
|
175
|
1 |
|
$properties->description = JsonBasicSchema::string(); |
|
|
|
|
176
|
1 |
|
$properties->default = (object)array(); |
|
|
|
|
177
|
1 |
|
$properties->multipleOf = JsonBasicSchema::number(); |
|
|
|
|
178
|
1 |
|
$properties->multipleOf->minimum = 0; |
|
|
|
|
179
|
1 |
|
$properties->multipleOf->exclusiveMinimum = true; |
180
|
1 |
|
$properties->maximum = JsonBasicSchema::number(); |
|
|
|
|
181
|
1 |
|
$properties->exclusiveMaximum = new JsonBasicSchema(); // draft6 |
|
|
|
|
182
|
|
|
$properties->exclusiveMaximum->type = array(Type::BOOLEAN, Type::NUMBER); // draft6 |
|
|
|
|
183
|
|
|
//$properties->exclusiveMaximum = JsonBasicSchema::boolean(); // draft6 |
184
|
1 |
|
//$properties->exclusiveMaximum->default = false; // draft6 |
185
|
1 |
|
$properties->minimum = JsonBasicSchema::number(); |
|
|
|
|
186
|
1 |
|
$properties->exclusiveMinimum = new JsonBasicSchema(); // draft6 |
|
|
|
|
187
|
|
|
$properties->exclusiveMinimum->type = array(Type::BOOLEAN, Type::NUMBER); // draft6 |
|
|
|
|
188
|
|
|
//$properties->exclusiveMinimum = JsonBasicSchema::boolean(); // draft6 |
189
|
1 |
|
//$properties->exclusiveMinimum->default = false; // draft6 |
190
|
1 |
|
$properties->maxLength = JsonBasicSchema::integer(); |
|
|
|
|
191
|
1 |
|
$properties->maxLength->minimum = 0; |
|
|
|
|
192
|
1 |
|
$properties->minLength = new JsonBasicSchema(); |
|
|
|
|
193
|
1 |
|
$properties->minLength->allOf[0] = JsonBasicSchema::integer(); |
|
|
|
|
194
|
1 |
|
$properties->minLength->allOf[0]->minimum = 0; |
195
|
1 |
|
$properties->minLength->allOf[1] = new JsonBasicSchema(); |
196
|
1 |
|
$properties->minLength->allOf[1]->default = 0; |
197
|
1 |
|
$properties->pattern = JsonBasicSchema::string(); |
|
|
|
|
198
|
1 |
|
$properties->pattern->format = 'regex'; |
|
|
|
|
199
|
1 |
|
$properties->additionalItems = new JsonBasicSchema(); |
|
|
|
|
200
|
1 |
|
$properties->additionalItems->anyOf[0] = JsonBasicSchema::boolean(); |
|
|
|
|
201
|
1 |
|
$properties->additionalItems->anyOf[1] = JsonBasicSchema::schema(); |
202
|
1 |
|
$properties->additionalItems->default = (object)array(); |
203
|
1 |
|
$properties->items = new JsonBasicSchema(); |
|
|
|
|
204
|
1 |
|
$properties->items->anyOf[0] = JsonBasicSchema::schema(); |
|
|
|
|
205
|
1 |
|
$properties->items->anyOf[1] = JsonBasicSchema::arr(); |
206
|
1 |
|
$properties->items->anyOf[1]->items = JsonBasicSchema::schema(); |
207
|
1 |
|
$properties->items->anyOf[1]->minItems = 1; |
208
|
1 |
|
$properties->items->default = (object)array(); |
209
|
1 |
|
$properties->maxItems = JsonBasicSchema::integer(); |
|
|
|
|
210
|
1 |
|
$properties->maxItems->minimum = 0; |
|
|
|
|
211
|
1 |
|
$properties->minItems = new JsonBasicSchema(); |
|
|
|
|
212
|
1 |
|
$properties->minItems->allOf[0] = JsonBasicSchema::integer(); |
|
|
|
|
213
|
1 |
|
$properties->minItems->allOf[0]->minimum = 0; |
214
|
1 |
|
$properties->minItems->allOf[1] = new JsonBasicSchema(); |
215
|
1 |
|
$properties->minItems->allOf[1]->default = 0; |
216
|
1 |
|
$properties->uniqueItems = JsonBasicSchema::boolean(); |
|
|
|
|
217
|
1 |
|
$properties->uniqueItems->default = false; |
|
|
|
|
218
|
1 |
|
$properties->maxProperties = JsonBasicSchema::integer(); |
|
|
|
|
219
|
1 |
|
$properties->maxProperties->minimum = 0; |
|
|
|
|
220
|
1 |
|
$properties->minProperties = new JsonBasicSchema(); |
|
|
|
|
221
|
1 |
|
$properties->minProperties->allOf[0] = JsonBasicSchema::integer(); |
|
|
|
|
222
|
1 |
|
$properties->minProperties->allOf[0]->minimum = 0; |
223
|
1 |
|
$properties->minProperties->allOf[1] = new JsonBasicSchema(); |
224
|
1 |
|
$properties->minProperties->allOf[1]->default = 0; |
225
|
1 |
|
$properties->required = JsonBasicSchema::arr(); |
|
|
|
|
226
|
1 |
|
$properties->required->items = JsonBasicSchema::string(); |
|
|
|
|
227
|
1 |
|
//$properties->required->minItems = 1; // disabled by draft6 |
228
|
|
|
$properties->required->uniqueItems = true; |
229
|
1 |
|
$properties->additionalProperties = new JsonBasicSchema(); |
|
|
|
|
230
|
1 |
|
$properties->additionalProperties->anyOf[0] = JsonBasicSchema::boolean(); |
|
|
|
|
231
|
1 |
|
$properties->additionalProperties->anyOf[1] = JsonBasicSchema::schema(); |
232
|
1 |
|
$properties->additionalProperties->default = (object)array(); |
233
|
1 |
|
$properties->definitions = JsonBasicSchema::object(); |
|
|
|
|
234
|
1 |
|
$properties->definitions->additionalProperties = JsonBasicSchema::schema(); |
|
|
|
|
235
|
1 |
|
$properties->definitions->default = (object)array(); |
236
|
1 |
|
$properties->properties = JsonBasicSchema::object(); |
|
|
|
|
237
|
1 |
|
$properties->properties->additionalProperties = JsonBasicSchema::schema(); |
|
|
|
|
238
|
1 |
|
$properties->properties->default = (object)array(); |
239
|
1 |
|
$properties->patternProperties = JsonBasicSchema::object(); |
|
|
|
|
240
|
1 |
|
$properties->patternProperties->additionalProperties = JsonBasicSchema::schema(); |
|
|
|
|
241
|
1 |
|
$properties->patternProperties->default = (object)array(); |
242
|
1 |
|
$properties->dependencies = JsonBasicSchema::object(); |
|
|
|
|
243
|
1 |
|
$properties->dependencies->additionalProperties = new JsonBasicSchema(); |
|
|
|
|
244
|
1 |
|
$properties->dependencies->additionalProperties->anyOf[0] = JsonBasicSchema::schema(); |
245
|
1 |
|
$properties->dependencies->additionalProperties->anyOf[1] = JsonBasicSchema::arr(); |
246
|
1 |
|
$properties->dependencies->additionalProperties->anyOf[1]->items = JsonBasicSchema::string(); |
247
|
1 |
|
//$properties->dependencies->additionalProperties->anyOf[1]->minItems = 1; // disabled by draft6 |
248
|
1 |
|
$properties->dependencies->additionalProperties->anyOf[1]->uniqueItems = true; |
249
|
1 |
|
$properties->enum = JsonBasicSchema::arr(); |
|
|
|
|
250
|
1 |
|
$properties->enum->minItems = 1; |
|
|
|
|
251
|
1 |
|
$properties->enum->uniqueItems = true; |
252
|
|
|
$properties->type = new JsonBasicSchema(); |
|
|
|
|
253
|
1 |
|
$anyOf0 = new JsonBasicSchema(); |
254
|
1 |
|
$anyOf0->enum = array( |
255
|
1 |
|
self::_ARRAY, |
256
|
1 |
|
self::BOOLEAN, |
257
|
1 |
|
self::INTEGER, |
258
|
1 |
|
self::NULL, |
259
|
1 |
|
self::NUMBER, |
260
|
1 |
|
self::OBJECT, |
261
|
1 |
|
self::STRING, |
262
|
1 |
|
); |
263
|
1 |
|
$properties->type->anyOf[0] = $anyOf0; |
|
|
|
|
264
|
1 |
|
$properties->type->anyOf[1] = JsonBasicSchema::arr(); |
265
|
1 |
|
$properties->type->anyOf[1]->items = new JsonBasicSchema(); |
266
|
1 |
|
$properties->type->anyOf[1]->items->enum = array( |
|
|
|
|
267
|
|
|
self::_ARRAY, |
268
|
1 |
|
self::BOOLEAN, |
269
|
1 |
|
self::INTEGER, |
270
|
1 |
|
self::NULL, |
271
|
1 |
|
self::NUMBER, |
272
|
1 |
|
self::OBJECT, |
273
|
1 |
|
self::STRING, |
274
|
1 |
|
); |
275
|
1 |
|
$properties->type->anyOf[1]->minItems = 1; |
276
|
1 |
|
$properties->type->anyOf[1]->uniqueItems = true; |
277
|
1 |
|
$properties->format = JsonBasicSchema::string(); |
|
|
|
|
278
|
|
|
$properties->ref = JsonBasicSchema::string(); |
|
|
|
|
279
|
1 |
|
$properties->ref->format = Format::URI_REFERENCE; |
|
|
|
|
280
|
1 |
|
$ownerSchema->addPropertyMapping('$ref', self::names()->ref); |
|
|
|
|
281
|
1 |
|
$properties->allOf = JsonBasicSchema::arr(); |
|
|
|
|
282
|
1 |
|
$properties->allOf->items = JsonBasicSchema::schema(); |
|
|
|
|
283
|
1 |
|
$properties->allOf->minItems = 1; |
284
|
1 |
|
$properties->anyOf = JsonBasicSchema::arr(); |
|
|
|
|
285
|
1 |
|
$properties->anyOf->items = JsonBasicSchema::schema(); |
|
|
|
|
286
|
1 |
|
$properties->anyOf->minItems = 1; |
287
|
1 |
|
$properties->oneOf = JsonBasicSchema::arr(); |
|
|
|
|
288
|
1 |
|
$properties->oneOf->items = JsonBasicSchema::schema(); |
|
|
|
|
289
|
1 |
|
$properties->oneOf->minItems = 1; |
290
|
1 |
|
$properties->not = JsonBasicSchema::schema(); |
|
|
|
|
291
|
1 |
|
$ownerSchema->type = array(self::OBJECT, self::BOOLEAN); |
292
|
1 |
|
$ownerSchema->id = 'http://json-schema.org/draft-04/schema#'; |
293
|
1 |
|
$ownerSchema->schema = 'http://json-schema.org/draft-04/schema#'; |
294
|
1 |
|
$ownerSchema->description = 'Core schema meta-schema'; |
295
|
1 |
|
$ownerSchema->default = (object)array(); |
296
|
1 |
|
$ownerSchema->setFromRef(false); |
297
|
1 |
|
// disabled by draft6 |
298
|
1 |
|
/* |
299
|
1 |
|
$ownerSchema->dependencies = (object)array ( |
300
|
1 |
|
'exclusiveMaximum' => |
301
|
1 |
|
array ( |
302
|
|
|
0 => 'maximum', |
303
|
|
|
), |
304
|
|
|
'exclusiveMinimum' => |
305
|
|
|
array ( |
306
|
|
|
0 => 'minimum', |
307
|
|
|
), |
308
|
|
|
); |
309
|
|
|
*/ |
310
|
|
|
|
311
|
|
|
|
312
|
|
|
// draft6 |
313
|
|
|
$properties->const = (object)array(); |
|
|
|
|
314
|
|
|
$properties->contains = JsonBasicSchema::schema(); |
|
|
|
|
315
|
|
|
$properties->propertyNames = JsonBasicSchema::schema(); |
|
|
|
|
316
|
|
|
|
317
|
|
|
// draft7 |
318
|
1 |
|
$properties->if = JsonBasicSchema::schema(); |
|
|
|
|
319
|
1 |
|
$properties->then = JsonBasicSchema::schema(); |
|
|
|
|
320
|
1 |
|
$properties->else = JsonBasicSchema::schema(); |
|
|
|
|
321
|
|
|
|
322
|
|
|
$properties->contentEncoding = JsonBasicSchema::string(); |
|
|
|
|
323
|
1 |
|
$properties->contentMediaType = JsonBasicSchema::string(); |
|
|
|
|
324
|
1 |
|
} |
325
|
1 |
|
|
326
|
|
|
/** |
327
|
1 |
|
* @param string $id |
328
|
1 |
|
* @return $this |
329
|
1 |
|
* @codeCoverageIgnoreStart |
330
|
|
|
*/ |
331
|
|
|
public function setId($id) |
332
|
|
|
{ |
333
|
|
|
$this->id = $id; |
334
|
|
|
return $this; |
335
|
|
|
} |
336
|
|
|
/** @codeCoverageIgnoreEnd */ |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* @param string $schema |
340
|
|
|
* @return $this |
341
|
|
|
* @codeCoverageIgnoreStart |
342
|
|
|
*/ |
343
|
|
|
public function setSchema($schema) |
344
|
|
|
{ |
345
|
|
|
$this->schema = $schema; |
346
|
|
|
return $this; |
347
|
|
|
} |
348
|
|
|
/** @codeCoverageIgnoreEnd */ |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @param string $title |
352
|
|
|
* @return $this |
353
|
|
|
* @codeCoverageIgnoreStart |
354
|
|
|
*/ |
355
|
|
|
public function setTitle($title) |
356
|
|
|
{ |
357
|
|
|
$this->title = $title; |
358
|
|
|
return $this; |
359
|
|
|
} |
360
|
|
|
/** @codeCoverageIgnoreEnd */ |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* @param string $description |
364
|
|
|
* @return $this |
365
|
|
|
* @codeCoverageIgnoreStart |
366
|
|
|
*/ |
367
|
|
|
public function setDescription($description) |
368
|
|
|
{ |
369
|
|
|
$this->description = $description; |
370
|
|
|
return $this; |
371
|
|
|
} |
372
|
|
|
/** @codeCoverageIgnoreEnd */ |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* @param mixed $default |
376
|
|
|
* @return $this |
377
|
|
|
* @codeCoverageIgnoreStart |
378
|
|
|
*/ |
379
|
|
|
public function setDefault($default) |
380
|
|
|
{ |
381
|
|
|
$this->default = $default; |
382
|
|
|
return $this; |
383
|
|
|
} |
384
|
|
|
/** @codeCoverageIgnoreEnd */ |
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* @param float $multipleOf |
388
|
|
|
* @return $this |
389
|
|
|
* @codeCoverageIgnoreStart |
390
|
|
|
*/ |
391
|
|
|
public function setMultipleOf($multipleOf) |
392
|
|
|
{ |
393
|
|
|
$this->multipleOf = $multipleOf; |
394
|
|
|
return $this; |
395
|
|
|
} |
396
|
|
|
/** @codeCoverageIgnoreEnd */ |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* @param float $maximum |
400
|
|
|
* @return $this |
401
|
|
|
* @codeCoverageIgnoreStart |
402
|
|
|
*/ |
403
|
|
|
public function setMaximum($maximum) |
404
|
|
|
{ |
405
|
|
|
$this->maximum = $maximum; |
406
|
|
|
return $this; |
407
|
|
|
} |
408
|
|
|
/** @codeCoverageIgnoreEnd */ |
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* @param bool $exclusiveMaximum |
412
|
|
|
* @return $this |
413
|
|
|
* @codeCoverageIgnoreStart |
414
|
|
|
*/ |
415
|
|
|
public function setExclusiveMaximum($exclusiveMaximum) |
416
|
|
|
{ |
417
|
|
|
$this->exclusiveMaximum = $exclusiveMaximum; |
418
|
|
|
return $this; |
419
|
|
|
} |
420
|
|
|
/** @codeCoverageIgnoreEnd */ |
421
|
|
|
|
422
|
|
|
/** |
423
|
|
|
* @param float $minimum |
424
|
|
|
* @return $this |
425
|
|
|
* @codeCoverageIgnoreStart |
426
|
|
|
*/ |
427
|
|
|
public function setMinimum($minimum) |
428
|
|
|
{ |
429
|
|
|
$this->minimum = $minimum; |
430
|
|
|
return $this; |
431
|
|
|
} |
432
|
|
|
/** @codeCoverageIgnoreEnd */ |
433
|
|
|
|
434
|
|
|
/** |
435
|
|
|
* @param bool $exclusiveMinimum |
436
|
|
|
* @return $this |
437
|
|
|
* @codeCoverageIgnoreStart |
438
|
|
|
*/ |
439
|
|
|
public function setExclusiveMinimum($exclusiveMinimum) |
440
|
|
|
{ |
441
|
|
|
$this->exclusiveMinimum = $exclusiveMinimum; |
442
|
|
|
return $this; |
443
|
|
|
} |
444
|
|
|
/** @codeCoverageIgnoreEnd */ |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* @param int $maxLength |
448
|
|
|
* @return $this |
449
|
|
|
* @codeCoverageIgnoreStart |
450
|
|
|
*/ |
451
|
|
|
public function setMaxLength($maxLength) |
452
|
|
|
{ |
453
|
|
|
$this->maxLength = $maxLength; |
454
|
|
|
return $this; |
455
|
|
|
} |
456
|
|
|
/** @codeCoverageIgnoreEnd */ |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* @param int $minLength |
460
|
|
|
* @return $this |
461
|
|
|
* @codeCoverageIgnoreStart |
462
|
|
|
*/ |
463
|
|
|
public function setMinLength($minLength) |
464
|
|
|
{ |
465
|
|
|
$this->minLength = $minLength; |
466
|
|
|
return $this; |
467
|
|
|
} |
468
|
|
|
/** @codeCoverageIgnoreEnd */ |
469
|
|
|
|
470
|
|
|
/** |
471
|
|
|
* @param string $pattern |
472
|
|
|
* @return $this |
473
|
|
|
* @codeCoverageIgnoreStart |
474
|
|
|
*/ |
475
|
|
|
public function setPattern($pattern) |
476
|
|
|
{ |
477
|
|
|
$this->pattern = $pattern; |
478
|
|
|
return $this; |
479
|
|
|
} |
480
|
|
|
/** @codeCoverageIgnoreEnd */ |
481
|
|
|
|
482
|
|
|
/** |
483
|
|
|
* @param bool|JsonSchema $additionalItems |
484
|
|
|
* @return $this |
485
|
|
|
* @codeCoverageIgnoreStart |
486
|
|
|
*/ |
487
|
|
|
public function setAdditionalItems($additionalItems) |
488
|
|
|
{ |
489
|
|
|
$this->additionalItems = $additionalItems; |
490
|
|
|
return $this; |
491
|
|
|
} |
492
|
|
|
/** @codeCoverageIgnoreEnd */ |
493
|
|
|
|
494
|
|
|
/** |
495
|
|
|
* @param JsonSchema|JsonSchema[]|array $items |
496
|
|
|
* @return $this |
497
|
|
|
* @codeCoverageIgnoreStart |
498
|
|
|
*/ |
499
|
|
|
public function setItems($items) |
500
|
|
|
{ |
501
|
|
|
$this->items = $items; |
502
|
|
|
return $this; |
503
|
|
|
} |
504
|
|
|
/** @codeCoverageIgnoreEnd */ |
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* @param int $maxItems |
508
|
|
|
* @return $this |
509
|
|
|
* @codeCoverageIgnoreStart |
510
|
|
|
*/ |
511
|
|
|
public function setMaxItems($maxItems) |
512
|
|
|
{ |
513
|
|
|
$this->maxItems = $maxItems; |
514
|
|
|
return $this; |
515
|
|
|
} |
516
|
|
|
/** @codeCoverageIgnoreEnd */ |
517
|
|
|
|
518
|
|
|
/** |
519
|
|
|
* @param int $minItems |
520
|
|
|
* @return $this |
521
|
|
|
* @codeCoverageIgnoreStart |
522
|
|
|
*/ |
523
|
|
|
public function setMinItems($minItems) |
524
|
|
|
{ |
525
|
|
|
$this->minItems = $minItems; |
526
|
|
|
return $this; |
527
|
|
|
} |
528
|
|
|
/** @codeCoverageIgnoreEnd */ |
529
|
|
|
|
530
|
|
|
/** |
531
|
|
|
* @param bool $uniqueItems |
532
|
|
|
* @return $this |
533
|
|
|
* @codeCoverageIgnoreStart |
534
|
|
|
*/ |
535
|
|
|
public function setUniqueItems($uniqueItems) |
536
|
|
|
{ |
537
|
|
|
$this->uniqueItems = $uniqueItems; |
538
|
|
|
return $this; |
539
|
|
|
} |
540
|
|
|
/** @codeCoverageIgnoreEnd */ |
541
|
|
|
|
542
|
|
|
/** |
543
|
|
|
* @param int $maxProperties |
544
|
|
|
* @return $this |
545
|
|
|
* @codeCoverageIgnoreStart |
546
|
|
|
*/ |
547
|
|
|
public function setMaxProperties($maxProperties) |
548
|
|
|
{ |
549
|
|
|
$this->maxProperties = $maxProperties; |
550
|
|
|
return $this; |
551
|
|
|
} |
552
|
|
|
/** @codeCoverageIgnoreEnd */ |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* @param int $minProperties |
556
|
|
|
* @return $this |
557
|
|
|
* @codeCoverageIgnoreStart |
558
|
|
|
*/ |
559
|
|
|
public function setMinProperties($minProperties) |
560
|
|
|
{ |
561
|
|
|
$this->minProperties = $minProperties; |
562
|
|
|
return $this; |
563
|
|
|
} |
564
|
|
|
/** @codeCoverageIgnoreEnd */ |
565
|
|
|
|
566
|
|
|
/** |
567
|
|
|
* @param string[]|array $required |
568
|
|
|
* @return $this |
569
|
|
|
* @codeCoverageIgnoreStart |
570
|
|
|
*/ |
571
|
|
|
public function setRequired($required) |
572
|
|
|
{ |
573
|
|
|
$this->required = $required; |
574
|
|
|
return $this; |
575
|
|
|
} |
576
|
|
|
/** @codeCoverageIgnoreEnd */ |
577
|
|
|
|
578
|
|
|
/** |
579
|
|
|
* @param bool|JsonSchema $additionalProperties |
580
|
|
|
* @return $this |
581
|
|
|
* @codeCoverageIgnoreStart |
582
|
|
|
*/ |
583
|
|
|
public function setAdditionalProperties($additionalProperties) |
584
|
|
|
{ |
585
|
|
|
$this->additionalProperties = $additionalProperties; |
586
|
|
|
return $this; |
587
|
|
|
} |
588
|
|
|
/** @codeCoverageIgnoreEnd */ |
589
|
|
|
|
590
|
|
|
/** |
591
|
|
|
* @param JsonSchema[] $definitions |
592
|
|
|
* @return $this |
593
|
|
|
* @codeCoverageIgnoreStart |
594
|
|
|
*/ |
595
|
|
|
public function setDefinitions($definitions) |
596
|
|
|
{ |
597
|
|
|
$this->definitions = $definitions; |
598
|
|
|
return $this; |
599
|
|
|
} |
600
|
|
|
/** @codeCoverageIgnoreEnd */ |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* @param JsonSchema[] $properties |
604
|
|
|
* @return $this |
605
|
|
|
* @codeCoverageIgnoreStart |
606
|
|
|
*/ |
607
|
|
|
public function setProperties($properties) |
608
|
|
|
{ |
609
|
|
|
$this->properties = $properties; |
610
|
|
|
return $this; |
611
|
|
|
} |
612
|
|
|
/** @codeCoverageIgnoreEnd */ |
613
|
|
|
|
614
|
|
|
/** |
615
|
|
|
* @param JsonSchema[] $patternProperties |
616
|
|
|
* @return $this |
617
|
|
|
* @codeCoverageIgnoreStart |
618
|
|
|
*/ |
619
|
|
|
public function setPatternProperties($patternProperties) |
620
|
|
|
{ |
621
|
|
|
$this->patternProperties = $patternProperties; |
622
|
|
|
return $this; |
623
|
|
|
} |
624
|
|
|
/** @codeCoverageIgnoreEnd */ |
625
|
|
|
|
626
|
|
|
/** |
627
|
|
|
* @param JsonSchema[]|string[][]|array[] $dependencies |
628
|
|
|
* @return $this |
629
|
|
|
* @codeCoverageIgnoreStart |
630
|
|
|
*/ |
631
|
|
|
public function setDependencies($dependencies) |
632
|
|
|
{ |
633
|
|
|
$this->dependencies = $dependencies; |
634
|
|
|
return $this; |
635
|
|
|
} |
636
|
|
|
/** @codeCoverageIgnoreEnd */ |
637
|
|
|
|
638
|
|
|
/** |
639
|
|
|
* @param array $enum |
640
|
|
|
* @return $this |
641
|
|
|
* @codeCoverageIgnoreStart |
642
|
|
|
*/ |
643
|
|
|
public function setEnum($enum) |
644
|
|
|
{ |
645
|
|
|
$this->enum = $enum; |
646
|
|
|
return $this; |
647
|
|
|
} |
648
|
|
|
/** @codeCoverageIgnoreEnd */ |
649
|
|
|
|
650
|
|
|
/** |
651
|
|
|
* @param array $type |
652
|
|
|
* @return $this |
653
|
|
|
* @codeCoverageIgnoreStart |
654
|
|
|
*/ |
655
|
|
|
public function setType($type) |
656
|
|
|
{ |
657
|
|
|
$this->type = $type; |
658
|
|
|
return $this; |
659
|
|
|
} |
660
|
|
|
/** @codeCoverageIgnoreEnd */ |
661
|
|
|
|
662
|
|
|
/** |
663
|
|
|
* @param string $format |
664
|
|
|
* @return $this |
665
|
|
|
* @codeCoverageIgnoreStart |
666
|
|
|
*/ |
667
|
|
|
public function setFormat($format) |
668
|
|
|
{ |
669
|
|
|
$this->format = $format; |
670
|
|
|
return $this; |
671
|
|
|
} |
672
|
|
|
/** @codeCoverageIgnoreEnd */ |
673
|
|
|
|
674
|
|
|
/** |
675
|
|
|
* @param string $ref |
676
|
|
|
* @return $this |
677
|
|
|
* @codeCoverageIgnoreStart |
678
|
|
|
*/ |
679
|
|
|
public function setRef($ref) |
680
|
|
|
{ |
681
|
|
|
$this->ref = $ref; |
682
|
|
|
return $this; |
683
|
|
|
} |
684
|
|
|
/** @codeCoverageIgnoreEnd */ |
685
|
|
|
|
686
|
|
|
/** |
687
|
|
|
* @param JsonSchema[]|array $allOf |
688
|
|
|
* @return $this |
689
|
|
|
* @codeCoverageIgnoreStart |
690
|
|
|
*/ |
691
|
|
|
public function setAllOf($allOf) |
692
|
|
|
{ |
693
|
|
|
$this->allOf = $allOf; |
694
|
|
|
return $this; |
695
|
|
|
} |
696
|
|
|
/** @codeCoverageIgnoreEnd */ |
697
|
|
|
|
698
|
|
|
/** |
699
|
|
|
* @param JsonSchema[]|array $anyOf |
700
|
|
|
* @return $this |
701
|
|
|
* @codeCoverageIgnoreStart |
702
|
|
|
*/ |
703
|
|
|
public function setAnyOf($anyOf) |
704
|
|
|
{ |
705
|
|
|
$this->anyOf = $anyOf; |
706
|
|
|
return $this; |
707
|
|
|
} |
708
|
|
|
/** @codeCoverageIgnoreEnd */ |
709
|
|
|
|
710
|
|
|
/** |
711
|
|
|
* @param JsonSchema[]|array $oneOf |
712
|
|
|
* @return $this |
713
|
|
|
* @codeCoverageIgnoreStart |
714
|
|
|
*/ |
715
|
|
|
public function setOneOf($oneOf) |
716
|
|
|
{ |
717
|
|
|
$this->oneOf = $oneOf; |
718
|
|
|
return $this; |
719
|
|
|
} |
720
|
|
|
/** @codeCoverageIgnoreEnd */ |
721
|
|
|
|
722
|
|
|
/** |
723
|
|
|
* @param JsonSchema $not Core schema meta-schema |
724
|
|
|
* @return $this |
725
|
|
|
* @codeCoverageIgnoreStart |
726
|
|
|
*/ |
727
|
|
|
public function setNot($not) |
728
|
|
|
{ |
729
|
|
|
$this->not = $not; |
730
|
|
|
return $this; |
731
|
|
|
} |
732
|
|
|
/** @codeCoverageIgnoreEnd */ |
733
|
|
|
} |
734
|
|
|
|
735
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..