diff --git a/src/Objects/Components.php b/src/Objects/Components.php index d1aa66d..1ab05fd 100644 --- a/src/Objects/Components.php +++ b/src/Objects/Components.php @@ -228,7 +228,7 @@ protected function generate(): array $callbacks = []; foreach ($this->callbacks ?? [] as $callback) { - $callbacks[$callback->objectId] = $callback; + $callbacks[$callback->objectId][$callback->route] = $callback; } return Arr::filter([ diff --git a/src/Objects/Operation.php b/src/Objects/Operation.php index 97333bc..47fed99 100644 --- a/src/Objects/Operation.php +++ b/src/Objects/Operation.php @@ -382,7 +382,7 @@ protected function generate(): array $callbacks = []; foreach ($this->callbacks ?? [] as $callback) { - $callbacks[$callback->objectId] = $callback; + $callbacks[$callback->objectId][$callback->route] = $callback; } return Arr::filter([ diff --git a/tests/Objects/ComponentsTest.php b/tests/Objects/ComponentsTest.php index af86eaa..eb738b0 100644 --- a/tests/Objects/ComponentsTest.php +++ b/tests/Objects/ComponentsTest.php @@ -110,9 +110,11 @@ public function create_with_all_parameters_works() ], 'callbacks' => [ 'MyEvent' => [ - 'post' => [ - 'requestBody' => [ - 'description' => 'something happened', + '{$request.query.callbackUrl}' => [ + 'post' => [ + 'requestBody' => [ + 'description' => 'something happened', + ], ], ], ], diff --git a/tests/Objects/OperationTest.php b/tests/Objects/OperationTest.php index fcc99c2..9458478 100644 --- a/tests/Objects/OperationTest.php +++ b/tests/Objects/OperationTest.php @@ -76,9 +76,11 @@ public function create_with_all_parameters_works() ], 'callbacks' => [ 'MyEvent' => [ - 'post' => [ - 'requestBody' => [ - 'description' => 'something happened', + '{$request.query.callbackUrl}' => [ + 'post' => [ + 'requestBody' => [ + 'description' => 'something happened', + ], ], ], ],