-
Notifications
You must be signed in to change notification settings - Fork 188
Description
Discussed in #1067
Originally posted by apasquini95 January 24, 2026
Hi everyone, with the latest version of scramble the Symfony\Component\HttpKernel\Exception\NotFoundHttpException is now ignored in the openapi specification, unless the Dedoc\Scramble\Support\ExceptionToResponseExtensions\NotFoundExceptionToResponseExtension is provided by the user in the scramble.extensions configuration file. Is it intended?
Before scramble 0.13.10 code like the following could be represented in the openapi specification with the correct 404 response:
class MyController extends Controller
{
public function __construct(private MyService $myService)
{
}
/**
* Summary of myHandler
* @param Request $request
* @return bool
* @throws NotFoundHttpException <--- This exception is thrown inside MyService
*/
public function myHandler(Request $request): bool
{
return $this->myService->isRequestOk($request);
}
}This specification was created by scramble 0.12.36:
"get": {
"operationId": "not-found-api",
"summary": "Summary of myHandler",
"tags": [
"My"
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "boolean"
}
}
}
},
"404": {
"$ref": "#/components/responses/NotFoundHttpException"
}
}
}But with scramble 0.13.10 the 404 response is missing:
"get": {
"operationId": "not-found-api",
"summary": "Summary of myHandler",
"tags": [
"My"
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "boolean"
}
}
}
}
// 404 missing ?
}
}The only way to restore it is to explicitly add the scramble's NotFoundExceptionToResponseExtension to the scramble configuration file:
// config/scramble.php
'extensions' => [
\Dedoc\Scramble\Support\ExceptionToResponseExtensions\NotFoundExceptionToResponseExtension::class,
]Is this the new way to obtain the 404 response documentation or is it a possible bug?
You can reproduce it by adding/removing the extension in the configuration file of this demo repository.
https://github.com/apasquini95/demo_scramble/tree/http_not_found_exception