From a48a8da3f6e2a6fcd12c6c2faeaf3287a50dc973 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko Date: Sun, 19 May 2024 11:03:48 +0300 Subject: [PATCH] documenting validation error when after method defined on a form request --- src/Support/OperationExtensions/ErrorResponsesExtension.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Support/OperationExtensions/ErrorResponsesExtension.php b/src/Support/OperationExtensions/ErrorResponsesExtension.php index de7cf3bf..92644f54 100644 --- a/src/Support/OperationExtensions/ErrorResponsesExtension.php +++ b/src/Support/OperationExtensions/ErrorResponsesExtension.php @@ -84,7 +84,10 @@ private function attachCustomRequestExceptions(FunctionType $methodType) $formRequest = $this->infer->analyzeClass($formRequest->name); - if ($formRequest->hasMethodDefinition('rules')) { + if ( + $formRequest->hasMethodDefinition('rules') + || $formRequest->hasMethodDefinition('after') + ) { $methodType->exceptions = [ ...$methodType->exceptions, new ObjectType(ValidationException::class),