As a reuser familiar with the concept of Wikibase language fallback, and the special position of "mul" code on Wikidata, I want to get a label or description in the requested language, or a respective language from the fallback chain, so that I can show them in my application.
GET /entities/items/{item_id}/labels_with_language_fallback/{language_code}
GET /entities/items/{item_id}/descriptions_with_language_fallback/{language_code}
GET /entities/properties/{property_id}/labels_with_language_fallback/{language_code}
GET /entities/properties/{property_id}/descriptions_with_language_fallback/{language_code}
All aspects of API behaviour (input validation, error responses, response structure, conditional HTTP header handling, authentication, etc) are to be same as for the respective no-language-fallback APIs unless stated otherwise
- If there is no label or description defined in the language represented by {language_code} but they're defined in any of the languages defined by the Wikibase language fallback chain for {language_code}, API should respond with a 307 HTTP code, and include a Location header linking to a respective non-fallback resource, e.g. if there is no en label but there is one in mul on item Q123 GET /entities/items/Q123/labels_with_language_fallback/en is intended to result with 307 redirect response with Location: .../entities/items/Q123/labels/mul
- If there is no label or description in the requested language, and in any of the respective languages defined by Wikibase language fallback chain, API should respond with 404 resource-not-found response.
Task Breakdown Notes
- copy-paste existing GetLabel use case to GetLabelWithLanguageFallback and create new route handler for the new URL
- modify use case and route handler to handle language fallback
- create new interface ItemLabelWithFallbackRetriever
- use FallbackLabelDescriptionLookupFactory to create a language fallback lookup
- do not throw Redirect exception, instead return label with fallback language if no label exists in the requested language
- let RouteHandler handle 200 vs 307 response based on the response's language code (equal to requested language or not?)
- repeat for the other three routes