Once the schemas are published and served from schema.wikimedia.org(see T438208), reference them from the MediaWiki REST API codebase so the error response body produced by the error formatters is validated against the matching schema (V1 / V2 / RESTBase-compat).
Architectural note: Router selects/constructs ErrorFormatter based on errorSchemaVersion; ResponseFactory is where the formatter's array becomes the actual JSON body (createHttpError/createFromException/createLocalizedHttpError → encodeJson).
Validation needs to look at ResponseFactory's output, not just the formatter in isolation, since handlers can inject extra keys via HttpException::getErrorData().
Open question to fill in: validate at CI/test time, or at runtime?