Needs work
Project:
Drupal core
Version:
main
Component:
jsonapi.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2020 at 18:10 UTC
Updated:
5 Aug 2020 at 19:27 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mglamanIn doing this fix, it broke on the include for
uid.rolesfor the owner field.Comment #3
mglamanThis error is caused when it tries to find the public field name for
commerce_product_variation_type.By this time the entity has turned into the product and is no longer the variation.
Comment #4
mglamanOkay, so I was wrong about this and misunderstood how
getExpectedIncludedResourceResponseworks.Upon further investigation I saw the include path which caused errors was:
In Commerce Products reference their Variations, and the Variation has a backreference to its Product.
I don't know how it ended up with
commerce_product_variation_typeinstead ofcommerce_product_type(the proper public field name.)Comment #5
mglamanGabe helped rubber duck this with me. The problem is JSON:API auto alaises
typeto{entity_type_id}_typebecausetypeis a reserved word in the spec.Drupal core doesn't have multiple entities that regularly reference themselves where
"bundle" => "type". But Commerce does. In fact all of our entities have theirbundlekey astype.Throughout ResourceTestBase the
$this->resourceTyperesource type is invoked to get an internal field name for a public field. The problem is that the entity being inspected is changing and not of that resource type.