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 Schema extends ClassStructure { |
15
|
|
|
/** @var string */ |
16
|
|
|
public $ref; |
17
|
|
|
|
18
|
|
|
/** @var string */ |
19
|
|
|
public $format; |
20
|
|
|
|
21
|
|
|
/** @var string */ |
22
|
|
|
public $title; |
23
|
|
|
|
24
|
|
|
/** @var string */ |
25
|
|
|
public $description; |
26
|
|
|
|
27
|
|
|
public $default; |
28
|
|
|
|
29
|
|
|
/** @var float */ |
30
|
|
|
public $multipleOf; |
31
|
|
|
|
32
|
|
|
/** @var float */ |
33
|
|
|
public $maximum; |
34
|
|
|
|
35
|
|
|
/** @var bool */ |
36
|
|
|
public $exclusiveMaximum; |
37
|
|
|
|
38
|
|
|
/** @var float */ |
39
|
|
|
public $minimum; |
40
|
|
|
|
41
|
|
|
/** @var bool */ |
42
|
|
|
public $exclusiveMinimum; |
43
|
|
|
|
44
|
|
|
/** @var int */ |
45
|
|
|
public $maxLength; |
46
|
|
|
|
47
|
|
|
/** @var int */ |
48
|
|
|
public $minLength; |
49
|
|
|
|
50
|
|
|
/** @var string */ |
51
|
|
|
public $pattern; |
52
|
|
|
|
53
|
|
|
/** @var int */ |
54
|
|
|
public $maxItems; |
55
|
|
|
|
56
|
|
|
/** @var int */ |
57
|
|
|
public $minItems; |
58
|
|
|
|
59
|
|
|
/** @var bool */ |
60
|
|
|
public $uniqueItems; |
61
|
|
|
|
62
|
|
|
/** @var int */ |
63
|
|
|
public $maxProperties; |
64
|
|
|
|
65
|
|
|
/** @var int */ |
66
|
|
|
public $minProperties; |
67
|
|
|
|
68
|
|
|
/** @var string[]|array */ |
69
|
|
|
public $required; |
70
|
|
|
|
71
|
|
|
/** @var array */ |
72
|
|
|
public $enum; |
73
|
|
|
|
74
|
|
|
/** @var Schema|bool */ |
75
|
|
|
public $additionalProperties; |
76
|
|
|
|
77
|
|
|
/** @var array */ |
78
|
|
|
public $type; |
79
|
|
|
|
80
|
|
|
/** @var Schema|Schema[]|array */ |
81
|
|
|
public $items; |
82
|
|
|
|
83
|
|
|
/** @var Schema[]|array */ |
84
|
|
|
public $allOf; |
85
|
|
|
|
86
|
|
|
/** @var Schema[] */ |
87
|
|
|
public $properties; |
88
|
|
|
|
89
|
|
|
/** @var string */ |
90
|
|
|
public $discriminator; |
91
|
|
|
|
92
|
|
|
/** @var bool */ |
93
|
|
|
public $readOnly; |
94
|
|
|
|
95
|
|
|
/** @var Xml */ |
96
|
|
|
public $xml; |
97
|
|
|
|
98
|
|
|
/** @var ExternalDocs information about external documentation */ |
99
|
|
|
public $externalDocs; |
100
|
|
|
|
101
|
|
|
public $example; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param Properties|static $properties |
105
|
|
|
* @param JsonBasicSchema $ownerSchema |
106
|
|
|
*/ |
107
|
|
|
public static function setUpProperties($properties, JsonBasicSchema $ownerSchema) |
108
|
|
|
{ |
109
|
|
|
$properties->ref = JsonBasicSchema::string(); |
110
|
|
|
$ownerSchema->addPropertyMapping('$ref', self::names()->ref); |
|
|
|
|
111
|
|
|
$properties->format = JsonBasicSchema::string(); |
112
|
|
|
$properties->title = JsonBasicSchema::string(); |
113
|
|
|
$properties->description = JsonBasicSchema::string(); |
114
|
|
|
$properties->default = new JsonBasicSchema(); |
115
|
|
|
$properties->multipleOf = JsonBasicSchema::number(); |
116
|
|
|
$properties->multipleOf->minimum = 0; |
117
|
|
|
$properties->multipleOf->exclusiveMinimum = true; |
118
|
|
|
$properties->maximum = JsonBasicSchema::number(); |
119
|
|
|
$properties->exclusiveMaximum = JsonBasicSchema::boolean(); |
120
|
|
|
$properties->exclusiveMaximum->default = false; |
|
|
|
|
121
|
|
|
$properties->minimum = JsonBasicSchema::number(); |
122
|
|
|
$properties->exclusiveMinimum = JsonBasicSchema::boolean(); |
123
|
|
|
$properties->exclusiveMinimum->default = false; |
|
|
|
|
124
|
|
|
$properties->maxLength = JsonBasicSchema::integer(); |
125
|
|
|
$properties->maxLength->minimum = 0; |
126
|
|
|
$properties->minLength = new JsonBasicSchema(); |
127
|
|
|
$properties->minLength->allOf[0] = JsonBasicSchema::integer(); |
128
|
|
|
$properties->minLength->allOf[0]->minimum = 0; |
129
|
|
|
$properties->minLength->allOf[1] = new JsonBasicSchema(); |
130
|
|
|
$properties->minLength->allOf[1]->default = 0; |
|
|
|
|
131
|
|
|
$properties->pattern = JsonBasicSchema::string(); |
132
|
|
|
$properties->pattern->format = 'regex'; |
133
|
|
|
$properties->maxItems = JsonBasicSchema::integer(); |
134
|
|
|
$properties->maxItems->minimum = 0; |
135
|
|
|
$properties->minItems = new JsonBasicSchema(); |
136
|
|
|
$properties->minItems->allOf[0] = JsonBasicSchema::integer(); |
137
|
|
|
$properties->minItems->allOf[0]->minimum = 0; |
138
|
|
|
$properties->minItems->allOf[1] = new JsonBasicSchema(); |
139
|
|
|
$properties->minItems->allOf[1]->default = 0; |
|
|
|
|
140
|
|
|
$properties->uniqueItems = JsonBasicSchema::boolean(); |
141
|
|
|
$properties->uniqueItems->default = false; |
|
|
|
|
142
|
|
|
$properties->maxProperties = JsonBasicSchema::integer(); |
143
|
|
|
$properties->maxProperties->minimum = 0; |
144
|
|
|
$properties->minProperties = new JsonBasicSchema(); |
145
|
|
|
$properties->minProperties->allOf[0] = JsonBasicSchema::integer(); |
146
|
|
|
$properties->minProperties->allOf[0]->minimum = 0; |
147
|
|
|
$properties->minProperties->allOf[1] = new JsonBasicSchema(); |
148
|
|
|
$properties->minProperties->allOf[1]->default = 0; |
|
|
|
|
149
|
|
|
$properties->required = JsonBasicSchema::arr(); |
150
|
|
|
$properties->required->items = JsonBasicSchema::string(); |
151
|
|
|
$properties->required->minItems = 1; |
152
|
|
|
$properties->required->uniqueItems = true; |
153
|
|
|
$properties->enum = JsonBasicSchema::arr(); |
154
|
|
|
$properties->enum->minItems = 1; |
155
|
|
|
$properties->enum->uniqueItems = true; |
156
|
|
|
$properties->additionalProperties = new JsonBasicSchema(); |
157
|
|
|
$properties->additionalProperties->anyOf[0] = Schema::schema(); |
158
|
|
|
$properties->additionalProperties->anyOf[1] = JsonBasicSchema::boolean(); |
159
|
|
|
$properties->additionalProperties->default = new \stdClass(); |
|
|
|
|
160
|
|
|
$properties->type = new JsonBasicSchema(); |
161
|
|
|
$properties->type->anyOf[0] = new JsonBasicSchema(); |
162
|
|
|
$properties->type->anyOf[0]->enum = array ( |
163
|
|
|
0 => 'array', |
164
|
|
|
1 => 'boolean', |
165
|
|
|
2 => 'integer', |
166
|
|
|
3 => 'null', |
167
|
|
|
4 => 'number', |
168
|
|
|
5 => 'object', |
169
|
|
|
6 => 'string', |
170
|
|
|
); |
171
|
|
|
$properties->type->anyOf[1] = JsonBasicSchema::arr(); |
172
|
|
|
$properties->type->anyOf[1]->items = new JsonBasicSchema(); |
173
|
|
|
$properties->type->anyOf[1]->items->enum = array ( |
174
|
|
|
0 => 'array', |
175
|
|
|
1 => 'boolean', |
176
|
|
|
2 => 'integer', |
177
|
|
|
3 => 'null', |
178
|
|
|
4 => 'number', |
179
|
|
|
5 => 'object', |
180
|
|
|
6 => 'string', |
181
|
|
|
); |
182
|
|
|
$properties->type->anyOf[1]->minItems = 1; |
183
|
|
|
$properties->type->anyOf[1]->uniqueItems = true; |
184
|
|
|
$properties->items = new JsonBasicSchema(); |
185
|
|
|
$properties->items->anyOf[0] = Schema::schema(); |
186
|
|
|
$properties->items->anyOf[1] = JsonBasicSchema::arr(); |
187
|
|
|
$properties->items->anyOf[1]->items = Schema::schema(); |
188
|
|
|
$properties->items->anyOf[1]->minItems = 1; |
189
|
|
|
$properties->items->default = new \stdClass(); |
|
|
|
|
190
|
|
|
$properties->allOf = JsonBasicSchema::arr(); |
191
|
|
|
$properties->allOf->items = Schema::schema(); |
192
|
|
|
$properties->allOf->minItems = 1; |
193
|
|
|
$properties->properties = JsonBasicSchema::object(); |
194
|
|
|
$properties->properties->additionalProperties = Schema::schema(); |
195
|
|
|
$properties->properties->default = new \stdClass(); |
|
|
|
|
196
|
|
|
$properties->discriminator = JsonBasicSchema::string(); |
197
|
|
|
$properties->readOnly = JsonBasicSchema::boolean(); |
198
|
|
|
$properties->readOnly->default = false; |
|
|
|
|
199
|
|
|
$properties->xml = Xml::schema(); |
200
|
|
|
$properties->externalDocs = ExternalDocs::schema(); |
201
|
|
|
$properties->example = new JsonBasicSchema(); |
202
|
|
|
$ownerSchema->type = 'object'; |
|
|
|
|
203
|
|
|
$ownerSchema->additionalProperties = false; |
204
|
|
|
$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema(); |
205
|
|
|
$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
206
|
|
|
$ownerSchema->description = 'A deterministic version of a JSON Schema object.'; |
|
|
|
|
207
|
|
|
} |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
|
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@property
annotation 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.