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 Operation extends ClassStructure { |
15
|
|
|
/** @var string[]|array */ |
16
|
|
|
public $tags; |
17
|
|
|
|
18
|
|
|
/** @var string A brief summary of the operation. */ |
19
|
|
|
public $summary; |
20
|
|
|
|
21
|
|
|
/** @var string A longer description of the operation, GitHub Flavored Markdown is allowed. */ |
22
|
|
|
public $description; |
23
|
|
|
|
24
|
|
|
/** @var ExternalDocs information about external documentation */ |
25
|
|
|
public $externalDocs; |
26
|
|
|
|
27
|
|
|
/** @var string A unique identifier of the operation. */ |
28
|
|
|
public $operationId; |
29
|
|
|
|
30
|
|
|
/** @var string[]|array A list of MIME types the API can produce. */ |
31
|
|
|
public $produces; |
32
|
|
|
|
33
|
|
|
/** @var string[]|array A list of MIME types the API can consume. */ |
34
|
|
|
public $consumes; |
35
|
|
|
|
36
|
|
|
/** @var BodyParameter[]|HeaderParameterSubSchema[]|FormDataParameterSubSchema[]|QueryParameterSubSchema[]|PathParameterSubSchema[]|JsonReference[]|array The parameters needed to send a valid API call. */ |
37
|
|
|
public $parameters; |
38
|
|
|
|
39
|
|
|
/** @var Response[]|JsonReference[] Response objects names can either be any valid HTTP status code or 'default'. */ |
40
|
|
|
public $responses; |
41
|
|
|
|
42
|
|
|
/** @var string[]|array The transfer protocol of the API. */ |
43
|
|
|
public $schemes; |
44
|
|
|
|
45
|
|
|
/** @var bool */ |
46
|
|
|
public $deprecated; |
47
|
|
|
|
48
|
|
|
/** @var string[][]|array[][]|array */ |
49
|
|
|
public $security; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param Properties|static $properties |
53
|
|
|
* @param JsonBasicSchema $ownerSchema |
54
|
|
|
*/ |
55
|
|
|
public static function setUpProperties($properties, JsonBasicSchema $ownerSchema) |
56
|
|
|
{ |
57
|
|
|
$properties->tags = JsonBasicSchema::arr(); |
58
|
|
|
$properties->tags->items = JsonBasicSchema::string(); |
59
|
|
|
$properties->tags->uniqueItems = true; |
60
|
|
|
$properties->summary = JsonBasicSchema::string(); |
61
|
|
|
$properties->summary->description = 'A brief summary of the operation.'; |
|
|
|
|
62
|
|
|
$properties->description = JsonBasicSchema::string(); |
63
|
|
|
$properties->description->description = 'A longer description of the operation, GitHub Flavored Markdown is allowed.'; |
|
|
|
|
64
|
|
|
$properties->externalDocs = ExternalDocs::schema(); |
65
|
|
|
$properties->operationId = JsonBasicSchema::string(); |
66
|
|
|
$properties->operationId->description = 'A unique identifier of the operation.'; |
|
|
|
|
67
|
|
|
$properties->produces = new JsonBasicSchema(); |
68
|
|
|
$properties->produces->allOf[0] = JsonBasicSchema::arr(); |
69
|
|
|
$properties->produces->allOf[0]->items = JsonBasicSchema::string(); |
70
|
|
|
$properties->produces->allOf[0]->items->description = 'The MIME type of the HTTP message.'; |
71
|
|
|
$properties->produces->allOf[0]->uniqueItems = true; |
72
|
|
|
$properties->produces->description = 'A list of MIME types the API can produce.'; |
|
|
|
|
73
|
|
|
$properties->consumes = new JsonBasicSchema(); |
74
|
|
|
$properties->consumes->allOf[0] = JsonBasicSchema::arr(); |
75
|
|
|
$properties->consumes->allOf[0]->items = JsonBasicSchema::string(); |
76
|
|
|
$properties->consumes->allOf[0]->items->description = 'The MIME type of the HTTP message.'; |
77
|
|
|
$properties->consumes->allOf[0]->uniqueItems = true; |
78
|
|
|
$properties->consumes->description = 'A list of MIME types the API can consume.'; |
|
|
|
|
79
|
|
|
$properties->parameters = JsonBasicSchema::arr(); |
80
|
|
|
$properties->parameters->items = new JsonBasicSchema(); |
81
|
|
|
$properties->parameters->items->oneOf[0] = new JsonBasicSchema(); |
82
|
|
|
$properties->parameters->items->oneOf[0]->oneOf[0] = BodyParameter::schema(); |
83
|
|
|
$properties->parameters->items->oneOf[0]->oneOf[1] = JsonBasicSchema::object(); |
84
|
|
|
$properties->parameters->items->oneOf[0]->oneOf[1]->oneOf[0] = HeaderParameterSubSchema::schema(); |
85
|
|
|
$properties->parameters->items->oneOf[0]->oneOf[1]->oneOf[1] = FormDataParameterSubSchema::schema(); |
86
|
|
|
$properties->parameters->items->oneOf[0]->oneOf[1]->oneOf[2] = QueryParameterSubSchema::schema(); |
87
|
|
|
$properties->parameters->items->oneOf[0]->oneOf[1]->oneOf[3] = PathParameterSubSchema::schema(); |
88
|
|
|
$properties->parameters->items->oneOf[0]->oneOf[1]->required = array ( |
89
|
|
|
0 => 'name', |
90
|
|
|
1 => 'in', |
91
|
|
|
2 => 'type', |
92
|
|
|
); |
93
|
|
|
$properties->parameters->items->oneOf[1] = JsonReference::schema(); |
94
|
|
|
$properties->parameters->description = 'The parameters needed to send a valid API call.'; |
|
|
|
|
95
|
|
|
$properties->parameters->uniqueItems = true; |
96
|
|
|
$properties->responses = JsonBasicSchema::object(); |
97
|
|
|
$properties->responses->additionalProperties = false; |
98
|
|
|
$properties->responses->patternProperties['^([0-9]{3})$|^(default)$'] = new JsonBasicSchema(); |
99
|
|
|
$properties->responses->patternProperties['^([0-9]{3})$|^(default)$']->oneOf[0] = Response::schema(); |
100
|
|
|
$properties->responses->patternProperties['^([0-9]{3})$|^(default)$']->oneOf[1] = JsonReference::schema(); |
101
|
|
|
$properties->responses->patternProperties['^x-'] = new JsonBasicSchema(); |
102
|
|
|
$properties->responses->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
103
|
|
|
$properties->responses->not = JsonBasicSchema::object(); |
104
|
|
|
$properties->responses->not->additionalProperties = false; |
105
|
|
|
$properties->responses->not->patternProperties['^x-'] = new JsonBasicSchema(); |
106
|
|
|
$properties->responses->not->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
107
|
|
|
$properties->responses->description = 'Response objects names can either be any valid HTTP status code or \'default\'.'; |
|
|
|
|
108
|
|
|
$properties->responses->minProperties = 1; |
109
|
|
|
$properties->schemes = JsonBasicSchema::arr(); |
110
|
|
|
$properties->schemes->items = JsonBasicSchema::string(); |
111
|
|
|
$properties->schemes->items->enum = array ( |
112
|
|
|
0 => 'http', |
113
|
|
|
1 => 'https', |
114
|
|
|
2 => 'ws', |
115
|
|
|
3 => 'wss', |
116
|
|
|
); |
117
|
|
|
$properties->schemes->description = 'The transfer protocol of the API.'; |
|
|
|
|
118
|
|
|
$properties->schemes->uniqueItems = true; |
119
|
|
|
$properties->deprecated = JsonBasicSchema::boolean(); |
120
|
|
|
$properties->deprecated->default = false; |
|
|
|
|
121
|
|
|
$properties->security = JsonBasicSchema::arr(); |
122
|
|
|
$properties->security->items = JsonBasicSchema::object(); |
123
|
|
|
$properties->security->items->additionalProperties = JsonBasicSchema::arr(); |
124
|
|
|
$properties->security->items->additionalProperties->items = JsonBasicSchema::string(); |
125
|
|
|
$properties->security->items->additionalProperties->uniqueItems = true; |
126
|
|
|
$properties->security->uniqueItems = true; |
127
|
|
|
$ownerSchema->type = 'object'; |
|
|
|
|
128
|
|
|
$ownerSchema->additionalProperties = false; |
129
|
|
|
$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema(); |
130
|
|
|
$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
131
|
|
|
$ownerSchema->required = array ( |
132
|
|
|
0 => 'responses', |
133
|
|
|
); |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
|
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@property
annotation 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.