Hi there! ^_^

For my use case I am leveraging external_entities + external comment + with a custom CKAN + Solr client and everything is working great with a few minor patches. The one issue I am having is when inspecting queries via jsonapi I noticed the the UUID for my external entities along with when the external entity is included as a resource the UUID keeps changing. Instead I just wanted the UUID to be the "id" represented stored in both CKAN + Solr. This then resolved my UUID issues and I am able to fully leverage jsonapi with comment crud.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sylus created an issue. See original summary.

sylus’s picture

rp7’s picture

Good question why this is explicitly being prevented. I don't immediately see the reason. I tend to follow you & make this possible (again). Anyone else has an opinion about this?

Was added in one the very first commits (https://cgit.drupalcode.org/external_entities/commit/?id=33225962d6b30ba...).

Wim Leers’s picture

Status: Active » Reviewed & tested by the community

I think the idea was perhaps that external UUIDs aren't necessarily trustworthy? i.e. if UUIDs aren't actually universally unique, then conflicts are likely.

But obviously that prevents this use case.

I think this patch is fine.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: allow_for_uuid_to_be-2882887-2.patch, failed testing. View results

rp7’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Assigned: Unassigned » rp7
Status: Needs work » Needs review
rp7’s picture

Moving this issue to 2.x. Patch attached adds the uuid field to external entities.

rp7’s picture

Side note to the patch above: this makes the UUID field mapping required when adding/editing an external entity type. Unsure if we actually want this? Not mapping a UUID will break compatibility with JSON API FYI.

Wim Leers’s picture

Hm, this is tough. Generally speaking, UUIDs are to be preferred over IDs. Which is why JSON API requires them. But of course not every external entity type has one necessarily. UUIDs have pretty strict format requirements, IDs do not. I wonder if we can reliably compute a UUID using the external entity's ID as a seed.

rp7’s picture

I guess its possible, some interesting links:

But that would add some complexity to the module.

Another option is to make the UUID mapping non-required. We provide events for altering the mapping of raw data to entities. If someone requires a UUID for an external source which doesn't offer one, it can be done.

rp7’s picture

FileSize
1.68 KB

Previous patch missed something (the base field definition). Patch makes it possible to map a UUID & the mapping is not required.

  • rp7 committed 2cbfa19 on 8.x-2.x
    Issue #2882887 by rp7, sylus: Allow for UUID to be set from external...
rp7’s picture

Status: Needs review » Fixed

Setting this issue to fixed. UUID mapping is now possible, although not required.

As earlier suggested - if one has the need to map a UUID while the external source is not offering one, it can be done by altering the mapping of raw data to entities.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.