| 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. |
| 13 |
* |
| 14 |
* @see [Server Object](https://spec.openapis.org/oas/v3.1.1.html#server-object) |
| 15 |
* |
| 16 |
* @Annotation |
| 17 |
*/ |
| 18 |
class Server extends AbstractAnnotation |
| 19 |
{ |
| 20 |
/** |
| 21 |
* An URL to the target host. |
| 22 |
* |
| 23 |
* This URL supports Server Variables and may be relative, |
| 24 |
* to indicate that the host location is relative to the location where the OpenAPI document is being served. |
| 25 |
* Variable substitutions will be made when a variable is named in {brackets}. |
| 26 |
* |
| 27 |
* @var string |
| 28 |
*/ |
| 29 |
public $url = Generator::UNDEFINED; |
| 30 |
|
| 31 |
/** |
| 32 |
* An optional string describing the host designated by the URL. |
| 33 |
* |
| 34 |
* CommonMark syntax may be used for rich text representation. |
| 35 |
* |
| 36 |
* @var string |
| 37 |
*/ |
| 38 |
public $description = Generator::UNDEFINED; |
| 39 |
|
| 40 |
/** |
| 41 |
* A map between a variable name and its value. |
| 42 |
* |
| 43 |
* The value is used for substitution in the server's URL template. |
| 44 |
* |
| 45 |
* @var list<ServerVariable> |
| 46 |
*/ |
| 47 |
public $variables = Generator::UNDEFINED; |
| 48 |
|
| 49 |
/** |
| 50 |
* @inheritdoc |
| 51 |
*/ |
| 52 |
public static $_parents = [ |
| 53 |
OpenApi::class, |
| 54 |
PathItem::class, |
| 55 |
Operation::class, |
| 56 |
Get::class, |
| 57 |
Post::class, |
| 58 |
Put::class, |
| 59 |
Delete::class, |
| 60 |
Patch::class, |
| 61 |
Head::class, |
| 62 |
Options::class, |
| 63 |
Trace::class, |
| 64 |
Link::class, |
| 65 |
]; |
| 66 |
|
| 67 |
/** |
| 68 |
* @inheritdoc |
| 69 |
*/ |
| 70 |
public static $_nested = [ |
| 71 |
ServerVariable::class => ['variables', 'serverVariable'], |
| 72 |
Attachable::class => ['attachables'], |
| 73 |
]; |
| 74 |
|
| 75 |
/** |
| 76 |
* @inheritdoc |
| 77 |
*/ |
| 78 |
public static $_required = ['url']; |
| 79 |
|
| 80 |
/** |
| 81 |
* @inheritdoc |
| 82 |
*/ |
| 83 |
public static $_types = [ |
| 84 |
'url' => 'string', |
| 85 |
'description' => 'string', |
| 86 |
]; |
| 87 |
} |