Add error codes to error constraints & responses

Created on 2 October 2023, 9 months ago
Updated 30 October 2023, 8 months ago

Problem/Motivation

Built-in Symfony validation constraints define constants with UUIDs for each error reported by that constraint. They also define an $errorNames property mapping each UUID to the property name. When building the validation, the right error code is assigned using setCode.

By assigning error codes to all constraints provided by API Toolkit, we can also return these error codes in error responses so frontend implementations don't have to check error messages in order to handle certain errors in responses. The JSON API spec says error objects should have a code key with 'an application-specific error code, expressed as a string value'.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium DieterHolvoet Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024