You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Remove empty string defaults from entities (#1387)
* docs: Remove empty string defaults from entities
I'm not getting the SQL exception in 'Validating Data' section; empty strings are being stored instead of null being attempted.
The simplest fix is to remove the default empty strings from the entities.
This is using the Symfony and Composer install.
* Update index.md
* Update index.md
* Reinstate default empty strings where removed.
* Add unvalidated title explanation
* Add NotBlank constraint to title
Did you notice that the error was automatically serialized in JSON-LD and respects the Hydra Core vocabulary for errors?
635
-
It allows the client to easily extract useful information from the error. Anyway, it's bad to get a SQL error when submitting
636
-
a request. It means that we didn't use a valid input, and [it's a bad and dangerous practice](https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html).
629
+
The book is successfully created but there is a problem; we did not give it a title. It makes no sense to create a book record without a title so we really should have some validation measures in place to prevent this from being possible.
637
630
638
631
API Platform comes with a bridge with [the Symfony Validator Component](https://symfony.com/doc/current/validation.html).
639
632
Adding some of [its numerous validation constraints](https://symfony.com/doc/current/validation.html#supported-constraints)
@@ -654,6 +647,11 @@ Modify the following files as described in these patches:
0 commit comments