|
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\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 Info extends ClassStructure { |
|
15
|
|
|
/** @var string A unique and precise title of the API. */ |
|
16
|
|
|
public $title; |
|
17
|
|
|
|
|
18
|
|
|
/** @var string A semantic version number of the API. */ |
|
19
|
|
|
public $version; |
|
20
|
|
|
|
|
21
|
|
|
/** @var string A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. */ |
|
22
|
|
|
public $description; |
|
23
|
|
|
|
|
24
|
|
|
/** @var string The terms of service for the API. */ |
|
25
|
|
|
public $termsOfService; |
|
26
|
|
|
|
|
27
|
|
|
/** @var Contact Contact information for the owners of the API. */ |
|
28
|
|
|
public $contact; |
|
29
|
|
|
|
|
30
|
|
|
/** @var License */ |
|
31
|
|
|
public $license; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param Properties|static $properties |
|
35
|
|
|
* @param JsonBasicSchema $ownerSchema |
|
36
|
|
|
*/ |
|
37
|
|
|
public static function setUpProperties($properties, JsonBasicSchema $ownerSchema) |
|
38
|
|
|
{ |
|
39
|
|
|
$properties->title = JsonBasicSchema::string(); |
|
40
|
|
|
$properties->title->description = 'A unique and precise title of the API.'; |
|
41
|
|
|
$properties->version = JsonBasicSchema::string(); |
|
42
|
|
|
$properties->version->description = 'A semantic version number of the API.'; |
|
43
|
|
|
$properties->description = JsonBasicSchema::string(); |
|
44
|
|
|
$properties->description->description = 'A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.'; |
|
45
|
|
|
$properties->termsOfService = JsonBasicSchema::string(); |
|
46
|
|
|
$properties->termsOfService->description = 'The terms of service for the API.'; |
|
47
|
|
|
$properties->contact = Contact::schema(); |
|
48
|
|
|
$properties->license = License::schema(); |
|
49
|
|
|
$ownerSchema->type = 'object'; |
|
|
|
|
|
|
50
|
|
|
$ownerSchema->additionalProperties = false; |
|
51
|
|
|
$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema(); |
|
52
|
|
|
$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
53
|
|
|
$ownerSchema->description = 'General information about the API.'; |
|
54
|
|
|
$ownerSchema->required = array ( |
|
55
|
|
|
0 => 'version', |
|
56
|
|
|
1 => 'title', |
|
57
|
|
|
); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param string $title A unique and precise title of the API. |
|
62
|
|
|
* @return $this |
|
63
|
|
|
*/ |
|
64
|
|
|
public function setTitle($title) |
|
65
|
|
|
{ |
|
66
|
|
|
$this->title = $title; |
|
67
|
|
|
return $this; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param string $version A semantic version number of the API. |
|
72
|
|
|
* @return $this |
|
73
|
|
|
*/ |
|
74
|
|
|
public function setVersion($version) |
|
75
|
|
|
{ |
|
76
|
|
|
$this->version = $version; |
|
77
|
|
|
return $this; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param string $description A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. |
|
82
|
|
|
* @return $this |
|
83
|
|
|
*/ |
|
84
|
|
|
public function setDescription($description) |
|
85
|
|
|
{ |
|
86
|
|
|
$this->description = $description; |
|
87
|
|
|
return $this; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @param string $termsOfService The terms of service for the API. |
|
92
|
|
|
* @return $this |
|
93
|
|
|
*/ |
|
94
|
|
|
public function setTermsOfService($termsOfService) |
|
95
|
|
|
{ |
|
96
|
|
|
$this->termsOfService = $termsOfService; |
|
97
|
|
|
return $this; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @param Contact $contact Contact information for the owners of the API. |
|
102
|
|
|
* @return $this |
|
103
|
|
|
*/ |
|
104
|
|
|
public function setContact($contact) |
|
105
|
|
|
{ |
|
106
|
|
|
$this->contact = $contact; |
|
107
|
|
|
return $this; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @param License $license |
|
112
|
|
|
* @return $this |
|
113
|
|
|
*/ |
|
114
|
|
|
public function setLicense($license) |
|
115
|
|
|
{ |
|
116
|
|
|
$this->license = $license; |
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
|
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..