Input
Path: GET /rest.php/wikibase/v0/entities/lexemes/{id}
Path parameter: Lexeme ID e.g. L123
Query params: none, for now (_fields could be added in a future story)
Headers: conditional request headers (if-none-match, ...), authorization
Response body
id: stays as it is
lemmas: structure gets "flattened", same as the structure of labels and descriptions (language code -> value)
lexical_category: item id value, name changed to use an underscore instead of camel case lexicalCategory.
language: item id value
statements: same as the response structure of the item/property endpoints
forms:
- id: stays as it is
- representations: structure gets "flattened", same as the structure of labels and descriptions (language code -> value)
- statements: same as the response structure of the item/property endpoints
- grammatical_features: list of item id values, name changed to use an underscore instead of camel case
senses:
- id: stays as it is
- statements: same as the response structure of the item/property endpoints
- glosses: structure gets "flattened", same as the structure of labels and descriptions (language code -> value)
Response headers
- ETag for revision ID
- Last-Modified contains last modified date
Response status
200 for success
404 for not found
400 for invalid id
ADR: Principles to follow when creating the lexeme REST API
Task breakdown
- register GET /rest.php/wikibase/v0/entities/lexemes/{id}
- route handler + use case boilerplate
- initial e2e test
- enable dev routes on beta wikidata
- requires a patch in the integration/config repository
- load routes.dev.json file, similar to what already happens for the wikibase dev routes
- move statement read models and serializers that we need into a statements domain
- allow CRUD and lexeme to depend on this domain in the corresponding namespaces (arch test updates)
- update cross domain architecture test (if necessary)
- add lemmas field
- add lexical_category and language field
- add statements field (only for the lexeme, not yet for forms/senses)
- add forms field (might be multiple tickets)
- add senses field (might be multiple tickets)
- add ETag and Last-Modified response headers
- validate lexeme id path param
- handle lexeme not found
- handle lexeme redirects
- handle unexpected exceptions
- create RouteHandlersTest similar to what we have for CRUD/search domain routes