| 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 |
* An object representing a server variable for server URL template substitution. |
| 13 |
* |
| 14 |
* @see [Server Variable Object](https://spec.openapis.org/oas/v3.1.1.html#server-variable-object) |
| 15 |
* |
| 16 |
* @Annotation |
| 17 |
*/ |
| 18 |
class ServerVariable extends AbstractAnnotation |
| 19 |
{ |
| 20 |
/** |
| 21 |
* The key into Server->variables array. |
| 22 |
* |
| 23 |
* @var string |
| 24 |
*/ |
| 25 |
public $serverVariable = Generator::UNDEFINED; |
| 26 |
|
| 27 |
/** |
| 28 |
* An enumeration of values to be used if the substitution options are from a limited set. |
| 29 |
* |
| 30 |
* @var list<string|int|float|bool|\UnitEnum>|class-string |
| 31 |
*/ |
| 32 |
public $enum = Generator::UNDEFINED; |
| 33 |
|
| 34 |
/** |
| 35 |
* The default value to use for substitution, and to send, if an alternate value is not supplied. |
| 36 |
* |
| 37 |
* Unlike the Schema Object's default, this value must be provided by the consumer. |
| 38 |
* |
| 39 |
* @var string |
| 40 |
*/ |
| 41 |
public $default = Generator::UNDEFINED; |
| 42 |
|
| 43 |
/** |
| 44 |
* A map between a variable name and its value. |
| 45 |
* |
| 46 |
* The value is used for substitution in the server's URL template. |
| 47 |
* |
| 48 |
* @var array |
| 49 |
*/ |
| 50 |
public $variables = Generator::UNDEFINED; |
| 51 |
|
| 52 |
/** |
| 53 |
* An optional description for the server variable. |
| 54 |
* |
| 55 |
* CommonMark syntax MAY be used for rich text representation. |
| 56 |
* |
| 57 |
* @var string |
| 58 |
*/ |
| 59 |
public $description = Generator::UNDEFINED; |
| 60 |
|
| 61 |
/** |
| 62 |
* @inheritdoc |
| 63 |
*/ |
| 64 |
public static $_parents = [ |
| 65 |
Server::class, |
| 66 |
]; |
| 67 |
|
| 68 |
/** |
| 69 |
* @inheritdoc |
| 70 |
*/ |
| 71 |
public static $_required = ['default']; |
| 72 |
|
| 73 |
/** |
| 74 |
* @inheritdoc |
| 75 |
*/ |
| 76 |
public static $_types = [ |
| 77 |
'default' => 'string', |
| 78 |
'description' => 'string', |
| 79 |
]; |
| 80 |
|
| 81 |
/** |
| 82 |
* @inheritdoc |
| 83 |
*/ |
| 84 |
public static $_nested = [ |
| 85 |
Attachable::class => ['attachables'], |
| 86 |
]; |
| 87 |
} |