The Wikimedia OpenAPI linter requires at least one example or examples field under each media type in a response (wikimedia-response-example-exists rule, severity: warn). The Handler base class provides no standard mechanism for this.
Context
Handler::generateResponseSpec() builds responses['200'] with schema and headers, but never with examples:
'content' => [
'application/json' => [
'schema' => [ '$ref' => '...' ]
// ← no 'example' or 'examples'
]
]A workaround exists — SitemapHandlerBase overrides generateResponseSpec() entirely — but this requires duplicating base class logic and is not a general pattern. It is the reason site/v1 is the only module with response examples today.
20 warnings across all REST modules.
Conditions of acceptance
- Add a getResponseBodyExample() method (returning null by default) to the Handler base class, overridable by subclasses.
- When non-null, include the result as example under content['application/json'] in the object generated by generateResponseSpec().
- Add a unit test verifying the field is included when the method is overridden.