forked from zircote/swagger-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResponse.php
103 lines (90 loc) · 2.57 KB
/
Response.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php declare(strict_types=1);
/**
* @license Apache 2.0
*/
namespace OpenApi\Annotations;
use OpenApi\Generator;
/**
* @Annotation
* A "Response Object": https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#response-object
*
* Describes a single response from an API Operation, including design-time, static links to operations based on the response.
*/
class Response extends AbstractAnnotation
{
/**
* $ref See https://swagger.io/docs/specification/using-ref/.
*
* @var string
*/
public $ref = Generator::UNDEFINED;
/**
* The key into Operations->responses array.
*
* @var string a HTTP Status Code or "default"
*/
public $response = Generator::UNDEFINED;
/**
* A short description of the response.
* CommonMark syntax may be used for rich text representation.
*
* @var string
*/
public $description = Generator::UNDEFINED;
/**
* Maps a header name to its definition.
* RFC7230 states header names are case insensitive. https://tools.ietf.org/html/rfc7230#page-22
* If a response header is defined with the name "Content-Type", it shall be ignored.
*
* @var Header[]
*/
public $headers = Generator::UNDEFINED;
/**
* A map containing descriptions of potential response payloads.
* The key is a media type or media type range and the value describes it.
* For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*.
*
* @var MediaType[]
*/
public $content = Generator::UNDEFINED;
/**
* A map of operations links that can be followed from the response.
* The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
*
* @var array
*/
public $links = Generator::UNDEFINED;
/**
* @inheritdoc
*/
public static $_required = ['description'];
/**
* @inheritdoc
*/
public static $_types = [
'description' => 'string',
];
/**
* @inheritdoc
*/
public static $_nested = [
MediaType::class => ['content', 'mediaType'],
Header::class => ['headers', 'header'],
Link::class => ['links', 'link'],
];
/**
* @inheritdoc
*/
public static $_parents = [
Components::class,
Operation::class,
Get::class,
Post::class,
Put::class,
Patch::class,
Delete::class,
Head::class,
Options::class,
Trace::class,
];
}