| 1 |
<?php declare(strict_types=1); |
| 2 |
|
| 3 |
/** |
| 4 |
* @license Apache 2.0 |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace OpenApi\Annotations; |
| 8 |
|
| 9 |
use OpenApi\Generator; |
| 10 |
|
| 11 |
/** |
| 12 |
* A single encoding definition applied to a single schema property. |
| 13 |
* |
| 14 |
* @see [Encoding Object](https://spec.openapis.org/oas/v3.1.0.html#encoding-object) |
| 15 |
* |
| 16 |
* @Annotation |
| 17 |
*/ |
| 18 |
class Encoding extends AbstractAnnotation |
| 19 |
{ |
| 20 |
/** |
| 21 |
* The property name to which the encoding applies. |
| 22 |
* |
| 23 |
* @var string |
| 24 |
*/ |
| 25 |
public $property = Generator::UNDEFINED; |
| 26 |
|
| 27 |
/** |
| 28 |
* The content type. |
| 29 |
* |
| 30 |
* @var string |
| 31 |
*/ |
| 32 |
public $contentType = Generator::UNDEFINED; |
| 33 |
|
| 34 |
/** |
| 35 |
* Additional headers. |
| 36 |
* |
| 37 |
* @var list<Header> |
| 38 |
*/ |
| 39 |
public $headers = Generator::UNDEFINED; |
| 40 |
|
| 41 |
/** |
| 42 |
* @var string |
| 43 |
*/ |
| 44 |
public $style = Generator::UNDEFINED; |
| 45 |
|
| 46 |
/** |
| 47 |
* @var bool |
| 48 |
*/ |
| 49 |
public $explode = Generator::UNDEFINED; |
| 50 |
|
| 51 |
/** |
| 52 |
* @var bool |
| 53 |
*/ |
| 54 |
public $allowReserved = Generator::UNDEFINED; |
| 55 |
|
| 56 |
/** |
| 57 |
* @inheritdoc |
| 58 |
*/ |
| 59 |
public static $_parents = [ |
| 60 |
JsonContent::class, |
| 61 |
XmlContent::class, |
| 62 |
MediaType::class, |
| 63 |
Property::class, |
| 64 |
]; |
| 65 |
|
| 66 |
/** |
| 67 |
* @inheritdoc |
| 68 |
*/ |
| 69 |
public static $_nested = [ |
| 70 |
Header::class => ['headers', 'header'], |
| 71 |
Attachable::class => ['attachables'], |
| 72 |
]; |
| 73 |
|
| 74 |
/** |
| 75 |
* @inheritdoc |
| 76 |
*/ |
| 77 |
public static $_types = [ |
| 78 |
'contentType' => 'string', |
| 79 |
]; |
| 80 |
|
| 81 |
public function jsonSerialize(): \stdClass |
| 82 |
{ |
| 83 |
$data = parent::jsonSerialize(); |
| 84 |
|
| 85 |
unset($data->property); |
| 86 |
|
| 87 |
return $data; |
| 88 |
} |
| 89 |
} |