Problem/Motivation
It's not possible for code that works with references to discover reference fields in an extensible fashion.
Code has to hardcode the name of reference field types, e.g. 'entity_reference' (in core), 'entity_reference_revisions', 'dynamic_entity_reference' (in contrib).
#3057545: ResourceTypeRepository wrongly assumes that all entity reference fields have the setting "target_type" adds an EntityReferenceItemInterface which would allow calling a field to get the referenceable types instead of hacking into field settings.
But it would also be useful to add an annotation property to field types so field type plugins can declare themselves as a reference field.
Comments
Comment #2
bradjones1Thought: ER fields should mark the
idproperty as reserved, since json:api uses that pseudo-property for relationship resolution inFieldResolver.Comment #3
bradjones1Also, we must enforce the presence and type of the
entityproperty, as Drupal core (e.g., json:api) requires that ER fields be settable by passing a loaded entity.