From 7f8c5180abcce5e512906c56d6d8ada8aaa861e7 Mon Sep 17 00:00:00 2001 From: Garrett Grimm Date: Tue, 29 Nov 2022 12:00:42 -0800 Subject: [PATCH 1/2] Use array of operations to support multiple definitions per method --- src/spec/PathItem.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/spec/PathItem.php b/src/spec/PathItem.php index 4b2debcd..2a76964a 100644 --- a/src/spec/PathItem.php +++ b/src/spec/PathItem.php @@ -50,14 +50,14 @@ protected function attributes(): array return [ 'summary' => Type::STRING, 'description' => Type::STRING, - 'get' => Operation::class, - 'put' => Operation::class, - 'post' => Operation::class, - 'delete' => Operation::class, - 'options' => Operation::class, - 'head' => Operation::class, - 'patch' => Operation::class, - 'trace' => Operation::class, + 'get' => [Operation::class], + 'put' => [Operation::class], + 'post' => [Operation::class], + 'delete' => [Operation::class], + 'options' => [Operation::class], + 'head' => [Operation::class], + 'patch' => [Operation::class], + 'trace' => [Operation::class], 'servers' => [Server::class], 'parameters' => [Parameter::class], ]; From 85fe8d1e36c423205aa6617b8d98aaf7c0074d00 Mon Sep 17 00:00:00 2001 From: Garrett Grimm Date: Tue, 29 Nov 2022 13:44:58 -0800 Subject: [PATCH 2/2] Update getOperations() to work with new structure --- src/spec/PathItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spec/PathItem.php b/src/spec/PathItem.php index 2a76964a..623656fa 100644 --- a/src/spec/PathItem.php +++ b/src/spec/PathItem.php @@ -116,7 +116,7 @@ public function getOperations() { $operations = []; foreach ($this->attributes() as $attribute => $type) { - if ($type === Operation::class && isset($this->$attribute)) { + if (\is_array($type) && $type[0] === Operation::class && isset($this->$attribute)) { $operations[$attribute] = $this->$attribute; } }