wmde / WikibaseReconcileEdit

GNU General Public License v2.0
3 stars 3 forks source link

Inject Wikibase services into EditEndpoint #11

Closed lucaswerkmeister closed 3 years ago

lucaswerkmeister commented 3 years ago

On REL1_35, they’re not yet available in the MediaWiki service container, but getting them in the factory() method and injecting them into the constructor is still better than getting them in the run() method. One thing this lets us do is inject a fake property datatype lookup in the test, which is probably more efficient than creating and saving a real property.

We pass the PropertyDataTypeLookup into the MinimalItemInput constructor, but apart from that the item input constructors still get their services from the default WikibaseRepo instance. I assume we’ll turn these into services of their own later.

Bug: T282244

lucaswerkmeister commented 3 years ago

We pass the PropertyDataTypeLookup into the MinimalItemInput constructor, but apart from that the item input constructors still get their services from the default WikibaseRepo instance. I assume we’ll turn these into services of their own later.

@toban I’d say that’s part of https://phabricator.wikimedia.org/T282243? :)

lucaswerkmeister commented 3 years ago

Wait a second. We’re only injecting our fake property datatype lookup into EditEndpoint, not into Wikibase itself… why can the item still be saved successfully?

lucaswerkmeister commented 3 years ago

I guess EditEntity gets an already deserialized entity and just assumes that all the referenced entities also exist… in normal API usage, an error that a property can’t be found would’ve been thrown at an earlier point, so it’s not EditEntity’s responsibility? And that’s why it works?