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
Copy file name to clipboardExpand all lines: core/validation.md
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -159,6 +159,33 @@ class Book
159
159
}
160
160
```
161
161
162
+
## Error Levels and Payload Serialization
163
+
164
+
As stated in the [Symfony documentation](https://symfony.com/doc/current/validation/severity.html), you can use the payload field to define error levels.
165
+
You can retrieve the payload field by setting the `serialize_payload_fields` option to `true` in the API Platform config:
166
+
167
+
```yaml
168
+
# app/config/config.yml
169
+
170
+
api_platform:
171
+
validator:
172
+
serialize_payload_fields: true
173
+
```
174
+
175
+
Then, the serializer will return all payload values in the error response.
176
+
177
+
If you want to serialize only some payload fields, define them in the config like this:
0 commit comments