From 308a9b437b94fef4df7113dcf7d2d5f3d5f551c2 Mon Sep 17 00:00:00 2001 From: sidux Date: Thu, 4 Apr 2024 14:48:59 +0200 Subject: [PATCH 1/3] feat(examples-prepartor): have more a more generic 200 status checking --- src/Preparator/ExamplesPreparator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Preparator/ExamplesPreparator.php b/src/Preparator/ExamplesPreparator.php index 5bbec4a..7aef10c 100644 --- a/src/Preparator/ExamplesPreparator.php +++ b/src/Preparator/ExamplesPreparator.php @@ -67,7 +67,9 @@ private function prepareTestCases(Operation $operation): iterable return $examples ->map( fn (OperationExample $example) => $this->buildTestCase( - $example->setAutoComplete($this->config->autoComplete) + $example + ->setStatusCode($this->config->response->statusCode) + ->setAutoComplete($this->config->autoComplete) ) ) ; From ae44efe19a5e5762dc4b119614b26777679fcfb1 Mon Sep 17 00:00:00 2001 From: sidux Date: Thu, 4 Apr 2024 14:58:46 +0200 Subject: [PATCH 2/3] feat(examples-prepartor): fix nullable status config --- src/Preparator/ExamplesPreparator.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Preparator/ExamplesPreparator.php b/src/Preparator/ExamplesPreparator.php index 7aef10c..92836bd 100644 --- a/src/Preparator/ExamplesPreparator.php +++ b/src/Preparator/ExamplesPreparator.php @@ -66,11 +66,13 @@ private function prepareTestCases(Operation $operation): iterable return $examples ->map( - fn (OperationExample $example) => $this->buildTestCase( - $example - ->setStatusCode($this->config->response->statusCode) - ->setAutoComplete($this->config->autoComplete) - ) + function (OperationExample $example) { + if ($this->config->response->statusCode !== null) { + $example->setStatusCode($this->config->response->statusCode); + } + $example->setAutoComplete($this->config->autoComplete); + $this->buildTestCase($example); + } ) ; } From cc21437e48e50040ca1bbcfd5bd172cb4efc031c Mon Sep 17 00:00:00 2001 From: sidux Date: Thu, 4 Apr 2024 15:01:15 +0200 Subject: [PATCH 3/3] feat(examples-prepartor): fix missing return --- src/Preparator/ExamplesPreparator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Preparator/ExamplesPreparator.php b/src/Preparator/ExamplesPreparator.php index 92836bd..1cc5bbc 100644 --- a/src/Preparator/ExamplesPreparator.php +++ b/src/Preparator/ExamplesPreparator.php @@ -71,7 +71,8 @@ function (OperationExample $example) { $example->setStatusCode($this->config->response->statusCode); } $example->setAutoComplete($this->config->autoComplete); - $this->buildTestCase($example); + + return $this->buildTestCase($example); } ) ;