Page MenuHomePhabricator

Validator for EntityId should check that foreign repo prefix is known
Closed, ResolvedPublic

Description

Validator for EntityId should check that:

  • the EntityIds foreign repo prefix is known
  • that foreign repo is enabled for the given entity type

This prevents unresolvable EntityIds from being added to Statements. But since validators are only applied to new data, this check would not prevent EntityIds with unknown repo prefixes to be displayed or otherwise handled.

Event Timeline

that foreign repo is enabled for the given entity type

How is this supposed to be done? By checking the repo specific entityNamespaces?

@Jakob_WMDE This has nothing to do with namespaces really.

We need to have a list of supported foreign repositories somewhere. Leszek is using the foreignRepository setting in I618b127, I suggest to use that for the validator too.

@daniel ahh right, I'll use the new setting. Thanks!
Just to clarify: I was considering entityNamespaces not because I thought it had anything to do with namespaces but because it says in the docs that "Mapping must be done for each type of entity that should be supported." and we marked it as one of the settings to be done per repo.

Good point. I think there should be a per-repo setting saying what entity types are enabled/relevant etc when using this particular repo.

BTW I haven't really thought much on how those settings should be configured but I believe for now the current format would still work fine. We might want to review it at some point, so we don't make a mess there.

Change 322093 had a related patch set uploaded (by Jakob):
Add ForeignEntityValidator.

https://gerrit.wikimedia.org/r/322093

Change 323404 had a related patch set uploaded (by Jakob):
Integrate ForeignEntityValidator with ValidatorBuilders.

https://gerrit.wikimedia.org/r/323404

Change 322093 merged by jenkins-bot:
Add ForeignEntityValidator.

https://gerrit.wikimedia.org/r/322093

Change 323404 merged by jenkins-bot:
Integrate ForeignEntityValidator with ValidatorBuilders.

https://gerrit.wikimedia.org/r/323404