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 Schema1; |
11
|
|
|
use Swaggest\JsonSchema\Structure\ClassStructure; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
class SwaggerSchema extends ClassStructure { |
15
|
|
|
/** @var string The Swagger version of this document. */ |
16
|
|
|
public $swagger; |
17
|
|
|
|
18
|
|
|
/** @var Info General information about the API. */ |
19
|
|
|
public $info; |
20
|
|
|
|
21
|
|
|
/** @var string The host (name or ip) of the API. Example: 'swagger.io' */ |
22
|
|
|
public $host; |
23
|
|
|
|
24
|
|
|
/** @var string The base path to the API. Example: '/api'. */ |
25
|
|
|
public $basePath; |
26
|
|
|
|
27
|
|
|
/** @var string[]|array The transfer protocol of the API. */ |
28
|
|
|
public $schemes; |
29
|
|
|
|
30
|
|
|
/** @var string[]|array A list of MIME types accepted by the API. */ |
31
|
|
|
public $consumes; |
32
|
|
|
|
33
|
|
|
/** @var string[]|array A list of MIME types the API can produce. */ |
34
|
|
|
public $produces; |
35
|
|
|
|
36
|
|
|
/** @var PathItem[] Relative paths to the individual endpoints. They must be relative to the 'basePath'. */ |
37
|
|
|
public $paths; |
38
|
|
|
|
39
|
|
|
/** @var Schema[] One or more JSON objects describing the schemas being consumed and produced by the API. */ |
40
|
|
|
public $definitions; |
41
|
|
|
|
42
|
|
|
/** @var BodyParameter[]|HeaderParameterSubSchema[]|FormDataParameterSubSchema[]|QueryParameterSubSchema[]|PathParameterSubSchema[] One or more JSON representations for parameters */ |
43
|
|
|
public $parameters; |
44
|
|
|
|
45
|
|
|
/** @var Response[] One or more JSON representations for parameters */ |
46
|
|
|
public $responses; |
47
|
|
|
|
48
|
|
|
/** @var string[][]|array[][]|array */ |
49
|
|
|
public $security; |
50
|
|
|
|
51
|
|
|
/** @var BasicAuthenticationSecurity[]|ApiKeySecurity[]|Oauth2ImplicitSecurity[]|Oauth2PasswordSecurity[]|Oauth2ApplicationSecurity[]|Oauth2AccessCodeSecurity[] */ |
52
|
|
|
public $securityDefinitions; |
53
|
|
|
|
54
|
|
|
/** @var Tag[]|array */ |
55
|
|
|
public $tags; |
56
|
|
|
|
57
|
|
|
/** @var ExternalDocs information about external documentation */ |
58
|
|
|
public $externalDocs; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param Properties|static $properties |
62
|
|
|
* @param Schema1 $ownerSchema |
63
|
|
|
*/ |
64
|
|
|
public static function setUpProperties($properties, Schema1 $ownerSchema) |
65
|
|
|
{ |
66
|
|
|
$properties->swagger = Schema1::string(); |
67
|
|
|
$properties->swagger->description = 'The Swagger version of this document.'; |
|
|
|
|
68
|
|
|
$properties->swagger->enum = array ( |
69
|
|
|
0 => '2.0', |
70
|
|
|
); |
71
|
|
|
$properties->info = Info::schema(); |
72
|
|
|
$properties->host = Schema1::string(); |
73
|
|
|
$properties->host->description = 'The host (name or ip) of the API. Example: \'swagger.io\''; |
|
|
|
|
74
|
|
|
$properties->host->pattern = '^[^{}/ :\\\\]+(?::\\d+)?$'; |
75
|
|
|
$properties->basePath = Schema1::string(); |
76
|
|
|
$properties->basePath->description = 'The base path to the API. Example: \'/api\'.'; |
|
|
|
|
77
|
|
|
$properties->basePath->pattern = '^/'; |
78
|
|
|
$properties->schemes = Schema1::arr(); |
79
|
|
|
$properties->schemes->items = Schema1::string(); |
80
|
|
|
$properties->schemes->items->enum = array ( |
81
|
|
|
0 => 'http', |
82
|
|
|
1 => 'https', |
83
|
|
|
2 => 'ws', |
84
|
|
|
3 => 'wss', |
85
|
|
|
); |
86
|
|
|
$properties->schemes->description = 'The transfer protocol of the API.'; |
|
|
|
|
87
|
|
|
$properties->schemes->uniqueItems = true; |
88
|
|
|
$properties->consumes = new Schema1(); |
89
|
|
|
$properties->consumes->allOf[0] = Schema1::arr(); |
90
|
|
|
$properties->consumes->allOf[0]->items = Schema1::string(); |
91
|
|
|
$properties->consumes->allOf[0]->items->description = 'The MIME type of the HTTP message.'; |
92
|
|
|
$properties->consumes->allOf[0]->uniqueItems = true; |
93
|
|
|
$properties->consumes->description = 'A list of MIME types accepted by the API.'; |
|
|
|
|
94
|
|
|
$properties->produces = new Schema1(); |
95
|
|
|
$properties->produces->allOf[0] = Schema1::arr(); |
96
|
|
|
$properties->produces->allOf[0]->items = Schema1::string(); |
97
|
|
|
$properties->produces->allOf[0]->items->description = 'The MIME type of the HTTP message.'; |
98
|
|
|
$properties->produces->allOf[0]->uniqueItems = true; |
99
|
|
|
$properties->produces->description = 'A list of MIME types the API can produce.'; |
|
|
|
|
100
|
|
|
$properties->paths = Schema1::object(); |
101
|
|
|
$properties->paths->additionalProperties = false; |
102
|
|
|
$properties->paths->patternProperties['^x-'] = new Schema1(); |
103
|
|
|
$properties->paths->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
104
|
|
|
$properties->paths->patternProperties['^/'] = PathItem::schema(); |
105
|
|
|
$properties->paths->description = 'Relative paths to the individual endpoints. They must be relative to the \'basePath\'.'; |
|
|
|
|
106
|
|
|
$properties->definitions = Schema1::object(); |
107
|
|
|
$properties->definitions->additionalProperties = Schema::schema(); |
108
|
|
|
$properties->definitions->description = 'One or more JSON objects describing the schemas being consumed and produced by the API.'; |
|
|
|
|
109
|
|
|
$properties->parameters = Schema1::object(); |
110
|
|
|
$properties->parameters->additionalProperties = new Schema1(); |
111
|
|
|
$properties->parameters->additionalProperties->oneOf[0] = BodyParameter::schema(); |
112
|
|
|
$properties->parameters->additionalProperties->oneOf[1] = Schema1::object(); |
113
|
|
|
$properties->parameters->additionalProperties->oneOf[1]->oneOf[0] = HeaderParameterSubSchema::schema(); |
114
|
|
|
$properties->parameters->additionalProperties->oneOf[1]->oneOf[1] = FormDataParameterSubSchema::schema(); |
115
|
|
|
$properties->parameters->additionalProperties->oneOf[1]->oneOf[2] = QueryParameterSubSchema::schema(); |
116
|
|
|
$properties->parameters->additionalProperties->oneOf[1]->oneOf[3] = PathParameterSubSchema::schema(); |
117
|
|
|
$properties->parameters->additionalProperties->oneOf[1]->required = array ( |
118
|
|
|
0 => 'name', |
119
|
|
|
1 => 'in', |
120
|
|
|
2 => 'type', |
121
|
|
|
); |
122
|
|
|
$properties->parameters->description = 'One or more JSON representations for parameters'; |
|
|
|
|
123
|
|
|
$properties->responses = Schema1::object(); |
124
|
|
|
$properties->responses->additionalProperties = Response::schema(); |
125
|
|
|
$properties->responses->description = 'One or more JSON representations for parameters'; |
|
|
|
|
126
|
|
|
$properties->security = Schema1::arr(); |
127
|
|
|
$properties->security->items = Schema1::object(); |
128
|
|
|
$properties->security->items->additionalProperties = Schema1::arr(); |
129
|
|
|
$properties->security->items->additionalProperties->items = Schema1::string(); |
130
|
|
|
$properties->security->items->additionalProperties->uniqueItems = true; |
131
|
|
|
$properties->security->uniqueItems = true; |
132
|
|
|
$properties->securityDefinitions = Schema1::object(); |
133
|
|
|
$properties->securityDefinitions->additionalProperties = new Schema1(); |
134
|
|
|
$properties->securityDefinitions->additionalProperties->oneOf[0] = BasicAuthenticationSecurity::schema(); |
135
|
|
|
$properties->securityDefinitions->additionalProperties->oneOf[1] = ApiKeySecurity::schema(); |
136
|
|
|
$properties->securityDefinitions->additionalProperties->oneOf[2] = Oauth2ImplicitSecurity::schema(); |
137
|
|
|
$properties->securityDefinitions->additionalProperties->oneOf[3] = Oauth2PasswordSecurity::schema(); |
138
|
|
|
$properties->securityDefinitions->additionalProperties->oneOf[4] = Oauth2ApplicationSecurity::schema(); |
139
|
|
|
$properties->securityDefinitions->additionalProperties->oneOf[5] = Oauth2AccessCodeSecurity::schema(); |
140
|
|
|
$properties->tags = Schema1::arr(); |
141
|
|
|
$properties->tags->items = Tag::schema(); |
142
|
|
|
$properties->tags->uniqueItems = true; |
143
|
|
|
$properties->externalDocs = ExternalDocs::schema(); |
144
|
|
|
$ownerSchema->type = 'object'; |
|
|
|
|
145
|
|
|
$ownerSchema->additionalProperties = false; |
146
|
|
|
$ownerSchema->patternProperties['^x-'] = new Schema1(); |
147
|
|
|
$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
148
|
|
|
$ownerSchema->id = 'http://swagger.io/v2/schema.json#'; |
|
|
|
|
149
|
|
|
$ownerSchema->schema = 'http://json-schema.org/draft-04/schema#'; |
|
|
|
|
150
|
|
|
$ownerSchema->title = 'A JSON Schema for Swagger 2.0 API.'; |
|
|
|
|
151
|
|
|
$ownerSchema->required = array ( |
152
|
|
|
0 => 'swagger', |
153
|
|
|
1 => 'info', |
154
|
|
|
2 => 'paths', |
155
|
|
|
); |
156
|
|
|
} |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
|
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.