daniel created this task.
daniel added projects: Wikidata, Lexicographical data, Story.

TASK DESCRIPTION

Some kinds of entities (e.g. Lexemes) cannot be "empty" - in other words, they have required constructor parameters.

In order to construct such entities from the data provided by a client (e.g. in a call to wbeditentity), we need code that can construct an Entity of a given type based on constructor parameters encoded in a JSON structure.

This is conceptually very similar to what ChangeOpDeserializer already does for modifications of entities (by constructing the respective ChangeOps from the a JSON structure provided by the client in an API call). The same should now be done for constructing an entity.

Note: constructor arguments will need to have the same validation applied that would be applied by ChangeOps for the respective fields. The ChangeOpDeserializer should already have access to any services required for this, since it is a factory for the ChangeOps that would perform the check.

Note: EntitySavingHelper will need to be changed quite a bit so it can use ChangeOpDeserializer::createEntity() instead of EntityFactory::newEmpty(). Once this is done, the EntityFactory class can be removed.

Note: Most API modules that use EntitySavingHelper do not get sufficient information from the client to construct a non-empty entity. Automatic create-on-edit for "virtual" entities only works for entity types that do not have any required fields (other than the ID).

See https://docs.google.com/document/d/1YwdF4xwmg36vDYgpbuO1xHNmhbCATLg3LOcnAt2VR-0/edit# for rationale and discussion


TASK DETAIL
https://phabricator.wikimedia.org/T166694

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: daniel
Cc: Aklapper, daniel, GoranSMilovanovic, QZanden, Izno, Wikidata-bugs, aude, Darkdadaah, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to