Wikibase
MediaWiki Wikibase extension
|
superseded - The headline "Don't use serialized entities in response objects" still applies, but in ADR 9 we changed to what is described as option 2 here.
Use case response objects are used to transfer data across the architectural boundary from the business logic to the presentation layer. Ideally they are simple DTOs with no dependencies. It is not recommended to use domain objects in use case requests or responses since the two may change for different reasons.
We initially decided to use serialized domain objects in the response objects, but ran into issues:
array
which makes it awkward and error-prone for consumers.We considered the follow options:
GetItem
use case which may return a whole Item
or only parts of it.Option 4 seems like the most practical approach. While we acknowledge that domain objects and use case responses serve different purposes, we believe that due to the nature of our code base this will rarely be problematic.
We will refactor the existing use cases to return (wrapped) entities instead of serialized entities. Serialization will happen in the presentation layer.