Page MenuHomePhabricator

🟫️ Don't use serialized entity data in use case responses
Closed, ResolvedPublic5 Estimated Story Points

Description

We found that serializing the entity in the use case forces us to deal with presentation concerns (serialization format, [] vs {}, ...) in the business layer. We will change the response objects to either contain entities or read models, and serialize later in the life-cycle.

Event Timeline

Change 790379 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] REST: Add ADR 2 - Don't serialize in use cases

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

Change 790379 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Add ADR 2 - Don't serialize in use cases

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

  • change GetItem use case to return an ItemData object in the response (@Ollie.Shotton_WMDE creates task)
    • create ItemData class
    • instantiate ItemData in the use case (to be moved into the retriever as part of T307915)
    • create ItemDataSerializer
    • serialize in presenter
  • change GetItemStatements to return a StatementList (@Jakob_WMDE creates task)
    • serialize in presenter
  • change GetItemStatement to return a Statement (@Ollie.Shotton_WMDE creates task)
    • serialize in presenter
Jakob_WMDE renamed this task from Don't use serialized entity data in use case responses to 🟫️ Don't use serialized entity data in use case responses.May 16 2022, 12:06 PM

Change 793408 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] REST: Remove EmptyArrayToObjectConverter

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

Change 793408 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Remove EmptyArrayToObjectConverter

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