1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the API Platform project. |
5
|
|
|
* |
6
|
|
|
* (c) Kévin Dunglas <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace ApiPlatform\Core\Annotation; |
15
|
|
|
|
16
|
|
|
use ApiPlatform\Core\Exception\InvalidArgumentException; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* ApiProperty annotation. |
20
|
|
|
* |
21
|
|
|
* @author Kévin Dunglas <[email protected]> |
22
|
|
|
* |
23
|
|
|
* @Annotation |
24
|
|
|
* @Target({"METHOD", "PROPERTY"}) |
25
|
|
|
* @Attributes( |
26
|
|
|
* @Attribute("deprecationReason", type="string"), |
27
|
|
|
* @Attribute("fetchable", type="bool"), |
28
|
|
|
* @Attribute("fetchEager", type="bool"), |
29
|
|
|
* @Attribute("openapiContext", type="array"), |
30
|
|
|
* @Attribute("jsonldContext", type="array"), |
31
|
|
|
* @Attribute("push", type="bool"), |
32
|
|
|
* @Attribute("swaggerContext", type="array") |
33
|
|
|
* ) |
34
|
|
|
*/ |
35
|
|
|
final class ApiProperty |
36
|
|
|
{ |
37
|
|
|
use AttributesHydratorTrait; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
public $description; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var bool |
46
|
|
|
*/ |
47
|
|
|
public $readable; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var bool |
51
|
|
|
*/ |
52
|
|
|
public $writable; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var bool |
56
|
|
|
*/ |
57
|
|
|
public $readableLink; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var bool |
61
|
|
|
*/ |
62
|
|
|
public $writableLink; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var bool |
66
|
|
|
*/ |
67
|
|
|
public $required; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
public $iri; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var bool |
76
|
|
|
*/ |
77
|
|
|
public $identifier; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var mixed |
81
|
|
|
*/ |
82
|
|
|
public $default; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var mixed |
86
|
|
|
*/ |
87
|
|
|
public $example; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112 |
91
|
|
|
* |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
private $deprecationReason; |
|
|
|
|
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112 |
98
|
|
|
* |
99
|
|
|
* @var bool |
100
|
|
|
*/ |
101
|
|
|
private $fetchable; |
|
|
|
|
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112 |
105
|
|
|
* |
106
|
|
|
* @var bool |
107
|
|
|
*/ |
108
|
|
|
private $fetchEager; |
|
|
|
|
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112 |
112
|
|
|
* |
113
|
|
|
* @var array |
114
|
|
|
*/ |
115
|
|
|
private $jsonldContext; |
|
|
|
|
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112 |
119
|
|
|
* |
120
|
|
|
* @var array |
121
|
|
|
*/ |
122
|
|
|
private $openapiContext; |
|
|
|
|
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112 |
126
|
|
|
* |
127
|
|
|
* @var bool |
128
|
|
|
*/ |
129
|
|
|
private $push; |
|
|
|
|
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112 |
133
|
|
|
* |
134
|
|
|
* @var array |
135
|
|
|
*/ |
136
|
|
|
private $swaggerContext; |
|
|
|
|
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @throws InvalidArgumentException |
140
|
|
|
*/ |
141
|
|
|
public function __construct(array $values = []) |
142
|
|
|
{ |
143
|
|
|
$this->hydrateAttributes($values); |
144
|
|
|
} |
145
|
|
|
} |
146
|
|
|
|