Spec Compliance: when error object 'id' key exists, it contains the individual resource URI, instead of "a unique identifier for this particular occurrence of the problem"

Created on 8 February 2018, over 6 years ago
Updated 26 May 2024, 3 months ago

Problem/Motivation

Discovered while working on #2930028: Comprehensive JSON API integration test coverage phase 1: for every entity type, individual resources only .

\Drupal\jsonapi\Normalizer\EntityAccessDeniedHttpExceptionNormalizer() does this:

      if (isset($entity)) {
        $errors[0]['id'] = sprintf(
          '/%s--%s/%s',
          $entity->getEntityTypeId(),
          $entity->bundle(),
          $entity->uuid()
        );
      }

yet http://jsonapi.org/format/#error-objects says:

An error object MAY have the following members:

- id: a unique identifier for this particular occurrence of the problem.

Yet something like /user--user/550e8400-e29b-41d4-a716-446655440000 is not a unique identifier for this particular occurrence of the problem!

This was introduced in #2844130: Create a custom EntityAccessDeniedHttpException .

Proposed resolution

Remove it.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Closed: works as designed

Version

8.9 ⚰️

Component
JSON API 

Last updated 1 day ago

Created by

🇧🇪Belgium Wim Leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024