|
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 AI will throw them away with no mercy. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Swaggest\JsonSchema\SwaggerSchema; |
|
8
|
|
|
|
|
9
|
|
|
use Swaggest\JsonSchema\Constraint\Properties; |
|
10
|
|
|
use Swaggest\JsonSchema\Schema as JsonBasicSchema; |
|
11
|
|
|
use Swaggest\JsonSchema\Structure\ClassStructure; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
class FileSchema extends ClassStructure { |
|
15
|
|
|
/** @var string */ |
|
16
|
|
|
public $format; |
|
17
|
|
|
|
|
18
|
|
|
/** @var string */ |
|
19
|
|
|
public $title; |
|
20
|
|
|
|
|
21
|
|
|
/** @var string */ |
|
22
|
|
|
public $description; |
|
23
|
|
|
|
|
24
|
|
|
public $default; |
|
25
|
|
|
|
|
26
|
|
|
/** @var string[]|array */ |
|
27
|
|
|
public $required; |
|
28
|
|
|
|
|
29
|
|
|
/** @var string */ |
|
30
|
|
|
public $type; |
|
31
|
|
|
|
|
32
|
|
|
/** @var bool */ |
|
33
|
|
|
public $readOnly; |
|
34
|
|
|
|
|
35
|
|
|
/** @var ExternalDocs information about external documentation */ |
|
36
|
|
|
public $externalDocs; |
|
37
|
|
|
|
|
38
|
|
|
public $example; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param Properties|static $properties |
|
42
|
|
|
* @param JsonBasicSchema $ownerSchema |
|
43
|
|
|
*/ |
|
44
|
|
|
public static function setUpProperties($properties, JsonBasicSchema $ownerSchema) |
|
45
|
|
|
{ |
|
46
|
|
|
$properties->format = JsonBasicSchema::string(); |
|
47
|
|
|
$properties->title = JsonBasicSchema::string(); |
|
48
|
|
|
$properties->description = JsonBasicSchema::string(); |
|
49
|
|
|
$properties->default = new JsonBasicSchema(); |
|
50
|
|
|
$properties->required = JsonBasicSchema::arr(); |
|
51
|
|
|
$properties->required->items = JsonBasicSchema::string(); |
|
52
|
|
|
$properties->required->minItems = 1; |
|
53
|
|
|
$properties->required->uniqueItems = true; |
|
54
|
|
|
$properties->type = JsonBasicSchema::string(); |
|
55
|
|
|
$properties->type->enum = array ( |
|
56
|
|
|
0 => 'file', |
|
57
|
|
|
); |
|
58
|
|
|
$properties->readOnly = JsonBasicSchema::boolean(); |
|
59
|
|
|
$properties->readOnly->default = false; |
|
|
|
|
|
|
60
|
|
|
$properties->externalDocs = ExternalDocs::schema(); |
|
61
|
|
|
$properties->example = new JsonBasicSchema(); |
|
62
|
|
|
$ownerSchema->type = 'object'; |
|
|
|
|
|
|
63
|
|
|
$ownerSchema->additionalProperties = false; |
|
64
|
|
|
$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema(); |
|
65
|
|
|
$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
|
|
66
|
|
|
$ownerSchema->description = 'A deterministic version of a JSON Schema object.'; |
|
|
|
|
|
|
67
|
|
|
$ownerSchema->required = array ( |
|
68
|
|
|
0 => 'type', |
|
69
|
|
|
); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
|
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write 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.