Skip to content

Commit

Permalink
fix: use valid type for webhook configuration example
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Beru committed Jan 14, 2025
1 parent 1ca1aaa commit f78341a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,11 @@ private function addWebhookConfigurationNode(string $name): NodeDefinition
->children()
->scalarNode('url')
->info('The URL to call.')
->example('https://webhook.site/#!/view/{some-token}')
->end()
->variableNode('route')
->arrayNode('route')
->info('Route configuration.')
->example(['my_route', ['param1' => 'value1', 'param2' => 'value2']])
->beforeNormalization()
->ifArray()
->then(function (array $v): array {
Expand All @@ -771,10 +773,7 @@ private function addWebhookConfigurationNode(string $name): NodeDefinition
})
->thenInvalid('The "route" parameter must be a string or an array containing a string and an array.')
->end()
->example([
'https://webhook.site/#!/view/{some-token}',
['my_route', ['param1' => 'value1', 'param2' => 'value2']],
])
->variablePrototype()->end()
->end()
->enumNode('method')
->info('HTTP method to use on that endpoint.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ public function testBuilderWebhookConfiguredWithValidConfiguration(): void
'foo' => [
'success' => [
'url' => 'https://sensiolabs.com/webhook',
'route' => [],
'method' => null,
],
'error' => [
Expand All @@ -531,6 +532,7 @@ public function testBuilderWebhookConfiguredWithValidConfiguration(): void
'.sensiolabs_gotenberg.pdf_builder.markdown.webhook_configuration' => [
'success' => [
'url' => 'https://sensiolabs.com/webhook-on-the-fly',
'route' => [],
'method' => null,
],
'error' => [
Expand Down

0 comments on commit f78341a

Please sign in to comment.