Context
As far as we have defined scheme for REST Api:
https://www.mediawiki.org/wiki/Core_Platform_Team/Initiatives/Core_REST_API_in_MediaWiki/Schema
it would be useful to have that represented in the code as Entities.
Say at the moment SearchHandler outputs results that contain the thumbnail using SearchResultThumbnail, but on the scheme, it's called FileRepresentation. File, according to the scheme should also contain preferred, medium fields of FileRepresentation type.
Though at the moment SearchResultTumbnails belongs to the MediaWiki\Search domain and has nothing common with, REST, in fact, every change in REST/scheme automatically should be reflected in SearchResultTumbnails, especially when adding new fields.
So, the goal is to reduce the mess in naming/modeling and make serialization simpler and more strict.
Expected Result:
- classes Page, Revision, File, FileRevision, FileRepresentation should be created under MediaWiki\REST\Entities namespace.
- Serializers that convert those classes into php array or JSON should be added for each fo file.
- (optionally) REST handlers should return entities rather than formatted JSON.