Skip to content

Commit 456be31

Browse files
authored
hint for mapping request payload error messages
1 parent 1659563 commit 456be31

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

controller.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,14 @@ payload formats::
502502
// ...
503503
}
504504

505+
.. tip::
506+
507+
If you write a json API, make sure to declare your route to use the json
508+
format. This will make the error handling output a json response in case of
509+
validation errors, rather than an HTML page.
510+
511+
``#[Route('/dashboard', name: 'dashboard', format: 'json')]
512+
505513
Make sure to install `phpstan/phpdoc-parser`_ and `phpdocumentor/type-resolver`_
506514
if you want to map a nested array of specific DTOs::
507515

0 commit comments

Comments
 (0)