Description
POST /entities/properties/{property_id}/aliases/{language_code}
request payload
{ "aliases": [ "ALIAS_TEXT", ... ] ... }
Acceptance criteria:
- The respective successful responses should present the list of aliases in a given language -- similar to the responses of GET /entities/properties/{property_id}/aliases/{language_code}.
- If there was no aliases in the given language before the successful request the response should use 201 code, otherwise 200.
Error cases to consider
HTTP response code | response payload | |
---|---|---|
Invalid property ID | 400 | "code": "invalid-property-id" "message": "Not a valid property ID: {property_id}" "context": { "property": "{property-id}" } |
Invalid language code | 400 | "code": "invalid-language-code" "message": "Not a valid language code: {language_code}" |
Alias contains invalid characters | 400 | "code": "invalid-alias" "message": "Not a valid alias: '{alias}'" "context": { "alias": <alias> } |
Alias is empty | 400 | "code": "alias-empty" "message": "Alias must not be empty" |
Alias list is empty | 400 | "code": "alias-list-empty" "message": "Alias list must not be empty" |
Alias too long | 400 | "code": "alias-too-long" "message": "Alias must be no more than {limit} characters long" "context": { "value": "{alias}", "character-limit": "{limit}" } |
Alias duplicate | 400 | "code": "duplicate-alias" "message": "Alias list contains a duplicate alias: '{alias}'" "context": { "alias": "{alias}" } |
Invalid edit tag | 400 | "code": "invalid-edit-tag" "message": "Invalid MediaWiki tag: {tag}" |
Comment too long | 400 | "code": "comment-too-long" "message": "Comment must not be longer than {limit} characters" |
Property does not exist | 404 | "code": "property-not-found" "message": "Could not find a property with the ID: {property_id}" |
Notes
- Automated edit summaries similar as done for items: T335842
- client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in GET /entities/properties/{property_id}/alias/{language_code}
- Handle HTTP conditional request headers as in POST /entities/items/{item_id}/aliases/{language_code}
- Handle user authentication/authorization like in POST /entities/items/{item_id}/aliases/{language_code}
Task breakdown notes:
- Add the new route to OAS.
- AddPropertyAliasesInLanguage happy path (including the edit summary)
- directly use the AliasesDeserializer for deserialization
- ETag and Last-Modified
- include difference between 200 OK and 201 CREATED cases
- Create use case validation/deserialization
- Respond 404 if property not found
- Authorization
- Use the usual middlewares and add the route handler to RouteHandlersTest
- Add spec tests.
- Mark as production ready.