Skip to content

Commit

Permalink
hotfix/fix-callbacks-generation (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
vyuldashev authored and matthew-inamdar committed Nov 18, 2019
1 parent fc83b8c commit eb68848
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Objects/Components.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion src/Objects/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
8 changes: 5 additions & 3 deletions tests/Objects/ComponentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
],
],
],
Expand Down
8 changes: 5 additions & 3 deletions tests/Objects/OperationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
],
],
],
Expand Down

0 comments on commit eb68848

Please sign in to comment.