Skip to content

Commit 5d60b86

Browse files
authored
fix: use valid type for webhook configuration example (#143)
1 parent 6513d66 commit 5d60b86

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/DependencyInjection/Configuration.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,11 @@ private function addWebhookConfigurationNode(string $name): NodeDefinition
752752
->children()
753753
->scalarNode('url')
754754
->info('The URL to call.')
755+
->example('https://webhook.site/#!/view/{some-token}')
755756
->end()
756-
->variableNode('route')
757+
->arrayNode('route')
757758
->info('Route configuration.')
759+
->example([['my_route', ['param1' => 'value1', 'param2' => 'value2']]])
758760
->beforeNormalization()
759761
->ifArray()
760762
->then(function (array $v): array {
@@ -771,10 +773,7 @@ private function addWebhookConfigurationNode(string $name): NodeDefinition
771773
})
772774
->thenInvalid('The "route" parameter must be a string or an array containing a string and an array.')
773775
->end()
774-
->example([
775-
'https://webhook.site/#!/view/{some-token}',
776-
['my_route', ['param1' => 'value1', 'param2' => 'value2']],
777-
])
776+
->variablePrototype()->end()
778777
->end()
779778
->enumNode('method')
780779
->info('HTTP method to use on that endpoint.')

tests/DependencyInjection/SensiolabsGotenbergExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ public function testBuilderWebhookConfiguredWithValidConfiguration(): void
513513
'foo' => [
514514
'success' => [
515515
'url' => 'https://sensiolabs.com/webhook',
516+
'route' => [],
516517
'method' => null,
517518
],
518519
'error' => [
@@ -531,6 +532,7 @@ public function testBuilderWebhookConfiguredWithValidConfiguration(): void
531532
'.sensiolabs_gotenberg.pdf_builder.markdown.webhook_configuration' => [
532533
'success' => [
533534
'url' => 'https://sensiolabs.com/webhook-on-the-fly',
535+
'route' => [],
534536
'method' => null,
535537
],
536538
'error' => [

0 commit comments

Comments
 (0)