Add error codes to error constraints & responses

Created on 2 October 2023, about 1 year ago
Updated 30 October 2023, about 1 year 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.71.5 2024