We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1659563 commit 600b3b1Copy full SHA for 600b3b1
controller.rst
@@ -502,6 +502,14 @@ payload formats::
502
// ...
503
}
504
505
+.. tip::
506
+
507
+ If you build a JSON API, make sure to declare your route as using the JSON
508
+ :ref:`format <routing-format-parameter>`. This will make the error handling
509
+ output a JSON response in case of validation errors, rather than an HTML page::
510
511
+ #[Route('/dashboard', name: 'dashboard', format: 'json')]
512
513
Make sure to install `phpstan/phpdoc-parser`_ and `phpdocumentor/type-resolver`_
514
if you want to map a nested array of specific DTOs::
515
0 commit comments