diff --git a/src/Metadata/Exception/BadRequestException.php b/src/Metadata/Exception/BadRequestException.php new file mode 100644 index 00000000000..414a510b228 --- /dev/null +++ b/src/Metadata/Exception/BadRequestException.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace ApiPlatform\Metadata\Exception; + +/** + * Framework-agnostic 400 Bad Request, mapped by both the Symfony and Laravel error handlers. + */ +class BadRequestException extends \RuntimeException implements ExceptionInterface, HttpExceptionInterface +{ + public function getStatusCode(): int + { + return 400; + } + + /** + * @return array + */ + public function getHeaders(): array + { + return []; + } +} diff --git a/tests/Functional/McpTest.php b/tests/Functional/McpTest.php index 5cff5220061..7794f671e5e 100644 --- a/tests/Functional/McpTest.php +++ b/tests/Functional/McpTest.php @@ -470,7 +470,7 @@ public function testToolsList(): void 'id' => ['type' => 'integer'], 'title' => ['type' => 'string'], 'isbn' => ['type' => 'string'], - 'status' => ['type' => ['string', 'null']], + 'status' => ['anyOf' => [['type' => 'string'], ['type' => 'null']]], ], ], ],