Needs work
Project:
Drupal core
Version:
main
Component:
jsonapi.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
12 Apr 2022 at 12:50 UTC
Updated:
19 Apr 2022 at 08:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jsacksick commentedThis probably requires tests coverage, but just submitting the patch to see if the JSON API maintainers would like to see this happen first.
Comment #4
bbralaWhat would that code field contain? When i look at the tests it seems like its the uuid of the resource, which you know anyhow. This feels rather redundant. If its a relevant errorcode, it feel more helpfull. But how consistent is it is the next question then. A field that sometimes appears is not something i'd prefer.
Could you perhaps explain a little more about the usecase?
Comment #5
jsacksick commented@bbrala: Commerce defines a service for checking the availability of a purchasable entity (the AvailabilityManager).
The availability manager invokes logic from "availability checkers" which are tagged services.
The availability manager is invoked via a constraint validator attached to the "purchased_entity" field (which is on the order item). Currently availability checkers can return an
AvaillabilityResultand specify a reason why a given purchasable entity isn't available.I recently opened #3274829: Allow availability results to return a "code" to allow availability checkers to return a "code" alongside the availability result.
This Drupal core patch allows me returning the code alongside the response.
Does that answer your question?
Comment #6
bbralaYes thank you for your explaination, will have look soon :)