20
20
* @property Server[] $servers
21
21
* @property Paths|PathItem[] $paths
22
22
* @property Components|null $components
23
+ * @property PathItem[]|null $webhooks
23
24
* @property SecurityRequirement[] $security
24
25
* @property Tag[] $tags
25
26
* @property ExternalDocumentation|null $externalDocs
@@ -46,6 +47,7 @@ protected function attributes(): array
46
47
'info ' => Info::class,
47
48
'servers ' => [Server::class],
48
49
'paths ' => Paths::class,
50
+ 'webhooks ' => [PathItem::class],
49
51
'components ' => Components::class,
50
52
'security ' => [SecurityRequirement::class],
51
53
'tags ' => [Tag::class],
@@ -83,7 +85,12 @@ public function __get($name)
83
85
*/
84
86
public function performValidation ()
85
87
{
86
- $ this ->requireProperties (['openapi ' , 'info ' , 'paths ' ]);
88
+ if ($ this ->getMajorVersion () === static ::VERSION_3_0 ) {
89
+ $ this ->requireProperties (['openapi ' , 'info ' , 'paths ' ]);
90
+ } else {
91
+ $ this ->requireProperties (['openapi ' , 'info ' ], ['paths ' , 'webhooks ' , 'components ' ]);
92
+ }
93
+
87
94
if (!empty ($ this ->openapi ) && !preg_match (static ::PATTERN_VERSION , $ this ->openapi )) {
88
95
$ this ->addError ('Unsupported openapi version: ' . $ this ->openapi );
89
96
}
0 commit comments