| 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 |
* The Link object represents a possible design-time link for a response. |
| 13 |
* |
| 14 |
* The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known |
| 15 |
* relationship and traversal mechanism between responses and other operations. |
| 16 |
* |
| 17 |
* Unlike dynamic links (i.e. links provided in the response payload), the OA linking mechanism does not require |
| 18 |
* link information in the runtime response. |
| 19 |
* |
| 20 |
* For computing links, and providing instructions to execute them, a runtime expression is used for |
| 21 |
* accessing values in an operation and using them as parameters while invoking the linked operation. |
| 22 |
* |
| 23 |
* @see [Link Object](https://spec.openapis.org/oas/v3.1.1.html#link-object) |
| 24 |
* |
| 25 |
* @Annotation |
| 26 |
*/ |
| 27 |
class Link extends AbstractAnnotation |
| 28 |
{ |
| 29 |
/** |
| 30 |
* @see [Reference Object](https://spec.openapis.org/oas/v3.1.1.html#reference-object) |
| 31 |
* |
| 32 |
* @var string|class-string|object |
| 33 |
*/ |
| 34 |
public $ref = Generator::UNDEFINED; |
| 35 |
|
| 36 |
/** |
| 37 |
* The key into MediaType->links array. |
| 38 |
* |
| 39 |
* @var string |
| 40 |
*/ |
| 41 |
public $link = Generator::UNDEFINED; |
| 42 |
|
| 43 |
/** |
| 44 |
* A relative or absolute reference to an OA operation. |
| 45 |
* |
| 46 |
* This field is mutually exclusive of the <code>operationId</code> field, and must point to an Operation object. |
| 47 |
* |
| 48 |
* Relative values may be used to locate an existing Operation object in the OpenAPI definition. |
| 49 |
* |
| 50 |
* @var string |
| 51 |
*/ |
| 52 |
public $operationRef = Generator::UNDEFINED; |
| 53 |
|
| 54 |
/** |
| 55 |
* The name of an existing, resolvable OA operation, as defined with a unique <code>operationId</code>. |
| 56 |
* |
| 57 |
* This field is mutually exclusive of the <code>operationRef</code> field. |
| 58 |
* |
| 59 |
* @var string |
| 60 |
*/ |
| 61 |
public $operationId = Generator::UNDEFINED; |
| 62 |
|
| 63 |
/** |
| 64 |
* A map representing parameters to pass to an operation as specified with operationId or identified via |
| 65 |
* operationRef. |
| 66 |
* |
| 67 |
* The key is the parameter name to be used, whereas the value can be a constant or an expression to |
| 68 |
* be evaluated and passed to the linked operation. |
| 69 |
* The parameter name can be qualified using the parameter location [{in}.]{name} for operations |
| 70 |
* that use the same parameter name in different locations (e.g. path.id). |
| 71 |
* |
| 72 |
* @var array<string,mixed> |
| 73 |
*/ |
| 74 |
public $parameters = Generator::UNDEFINED; |
| 75 |
|
| 76 |
/** |
| 77 |
* A literal value or {expression} to use as a request body when calling the target operation. |
| 78 |
* |
| 79 |
* @var mixed |
| 80 |
*/ |
| 81 |
public $requestBody = Generator::UNDEFINED; |
| 82 |
|
| 83 |
/** |
| 84 |
* A description of the link. |
| 85 |
* |
| 86 |
* CommonMark syntax may be used for rich text representation. |
| 87 |
* |
| 88 |
* @var string |
| 89 |
*/ |
| 90 |
public $description = Generator::UNDEFINED; |
| 91 |
|
| 92 |
/** |
| 93 |
* A server object to be used by the target operation. |
| 94 |
* |
| 95 |
* @var Server |
| 96 |
*/ |
| 97 |
public $server = Generator::UNDEFINED; |
| 98 |
|
| 99 |
/** |
| 100 |
* @inheritdoc |
| 101 |
*/ |
| 102 |
public static $_nested = [ |
| 103 |
Server::class => 'server', |
| 104 |
Attachable::class => ['attachables'], |
| 105 |
]; |
| 106 |
|
| 107 |
/** |
| 108 |
* @inheritdoc |
| 109 |
*/ |
| 110 |
public static $_parents = [ |
| 111 |
Components::class, |
| 112 |
Response::class, |
| 113 |
]; |
| 114 |
} |