2020 * @property Server[] $servers
2121 * @property Paths|PathItem[] $paths
2222 * @property Components|null $components
23+ * @property PathItem[]|null $webhooks
2324 * @property SecurityRequirement[] $security
2425 * @property Tag[] $tags
2526 * @property ExternalDocumentation|null $externalDocs
@@ -46,6 +47,7 @@ protected function attributes(): array
4647 'info ' => Info::class,
4748 'servers ' => [Server::class],
4849 'paths ' => Paths::class,
50+ 'webhooks ' => [PathItem::class],
4951 'components ' => Components::class,
5052 'security ' => [SecurityRequirement::class],
5153 'tags ' => [Tag::class],
@@ -83,7 +85,12 @@ public function __get($name)
8385 */
8486 public function performValidation ()
8587 {
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+
8794 if (!empty ($ this ->openapi ) && !preg_match (static ::PATTERN_VERSION , $ this ->openapi )) {
8895 $ this ->addError ('Unsupported openapi version: ' . $ this ->openapi );
8996 }
0 commit comments