This ticket is about creating a mediainfo entity on demand when hitting save the first time after adding labels, descriptions and/or aliases. A related task is T140760 to create a mediainfo entity on demand when adding a statement the first time.
Description
Details
Event Timeline
There are several places where the "on the fly" creation could be handled:
- in the client side JS code. It would know when an entity needs to be created with an extra call to wbeditentity before saving an edit.
- in the API module (more precisely, the ModifyEntity base class).
- in the EditEntity interactor.
- in the EntityStore.
- in the EntityRevisionLookup, on read, if in a POST request.
I personally tend towards doing this in the API, but there are good arguments for the other places, too. In particular, it's still unclear to me where we should maintain the knowledge about which entity types can be created on the fly, and which can't.
We should further consider whether we want to treat a MediaInfo entity as "existing" (in the context of EntityLookup, Special:EntityData, wbgetentities API calls, etc), when the corresponding File page exists, but no page was yet created for the MediaInfo entity.
Change 293339 had a related patch set uploaded (by Daniel Kinzler):
[WIP] Allow auto-creation of entities with custom ids.
Change 294350 had a related patch set uploaded (by Daniel Kinzler):
Allow auto-creation of MediaInfo entities.
Change 294365 had a related patch set uploaded (by Daniel Kinzler):
Allow entities to be created from all API modules.
Change 296602 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
Fixups to auto-creation of entities with custom ids
On Ia5f075eb3f1b, @adrianheine briedfly documented a discussion we had:
We had a discussion. Proposal is to have a getEntityForCreation or getEntityForEditing method on EntityStore
that takes the new parameter, id parameter and for properties the dataType part of the POST body.
I agree that this would be cleaner than my original proposal. Since the original patch got merged now, I decided to copy this here as a todo, so it doesn't get lost.
Change 294365 had a related patch set uploaded (by Jonas Kress (WMDE)):
Allow entities to be created from more API modules.
Change 293339 merged by jenkins-bot:
Allow auto-creation of entities with custom ids.
Change 294365 had a related patch set uploaded (by Jonas Kress (WMDE)):
Allow entities to be created from more API modules.
Change 296602 merged by jenkins-bot:
Fixups to auto-creation of entities with custom ids
Change 294365 merged by jenkins-bot:
Allow entities to be created from more API modules.