Page MenuHomePhabricator

๐Ÿ—๏ธ Modify data of a property
Open, Needs TriagePublic13 Estimated Story Points

Description

As a developer I want to be able to edit a Wikidata property

PATCH /entities/properties/{property_id}

Acceptance criteria

  • Request payload to be the same as the one for PATCH /entities/items/{item_id}
    • client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in PATCH /entities/items/{item_id}
  • Response to a success request will include the new statement data, including the ETag (revision ID) and modification timestamp
  • Handle HTTP conditional request headers as in PATCH /entities/items/{item_id}
  • Handle user authentication/authorization like in PATCH /entities/items/{item_id}
  • Edit summaries to be similar to that of https://phabricator.wikimedia.org/T342993

Error cases to consider

HTTP response coderesponse payload
Property does not exist 404"code": "property-not-found"
"message": "Could not find a property with the ID: {property_id}"
Invalid property ID 400"code": "invalid-property-id"
"message": "Not a valid property ID: {property_id}"
"context": {"property-id": "{property-id}"}
Request would change the ID of the property422"code": "patched-property-invalid-operation-change-property-id"
"message": "Cannot change the ID of the existing property"
Request would change the data type of the property422"code": "patched-property-invalid-operation-change-property-datatype"
"message": "Cannot change the datatype of the existing property"
Missing a mandatory field in JSON Patch (e.g. "path", "op")400"code": "missing-json-patch-field"
"message": "Missing '{field}' in JSON patch"
"context": { "operation": { <PATCH_OBJECT> }, "field": <MISSING_FIELD> }
Operation in the JSON Patch is not valid400"code": "invalid-patch-operation"
"message": "Incorrect JSON patch operation: '{op}'"
"context": { "op": "{op}", path": "/some/path" }
Value provided in the JSON Patch operation is of incorrect type400"code": "invalid-patch-field-type"
"message": "The value of '{field}' must be of type string"
"context": { "operation": { <PATCH_OBJECT> }, "field": <FIELD> }
Provided JSON Patch document is not valid (generic error)400"code": "invalid-patch"
"message": "The provided patch is invalid"
Cannot apply JSON Patch as target path not found409"code": "patch-target-not-found"
"message": "Target '{target}' not found on the resource"
"context": { "operation": { <PATCH_OBJECT> }, "field": <PATH> }
Test operation of JSON Patch failed409"code": "patch-test-failed"
"message": "Test operation in the provided patch failed. At path '{path}' expected '{expected}', actual: '{actual}'"
"context": { "operation": { <PATCH_OBJECT> }, "actual-value": <ACTUAL> }
Request payload is not JSON415"code": "unsupported-content-type"
"message": "Unsupported Content-Type: '{content_type}'"
Property after changes missing mandatory field422"code": "patched-property-missing-field"
"message": "Mandatory field missing in the patched property: '{field}''"
"context": { "path": "{field}"}
Value in the property data after changes is invalid422"code": "patched-property-invalid-field"
"message": "Invalid input for '{field}' in the patched property"
"context": { "path": "{field}", "value": "{value}"}
Unexpected field for property in patch request422"code": " patched-property-unexpected-field"
"message": "The patched property contains an unexpected field: {"field"}"
Statement id cannot be added or changed422"code": "statement-id-not-modifiable"
"message": "Statement IDs cannot be created or modified"
Invalid edit tag400{ "code": "invalid-edit-tag", "message": "Invalid MediaWiki tag: {tag}" }
Comment too long400{"code": "comment-too-long", "message": "Comment must not be longer than {limit} characters"}
Invalid statement group object400 "code": "invalid-statement-group-type"
"message": "Not a valid statement group"
"context": { "path":"{property_id}" }
Invalid statement object400 "code": "invalid-statement-type"
"message": "Not a valid statement type"
"context": { "path":"{property_id/index}" }
Statement group empty400 "code": "statement-group-empty"
"message": "No statement has been added for property id: "{property_id}""
"context": { "path":"{property_id}" }

Possibly relevant pointers:

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptSep 26 2023, 12:31 PM
Ollie.Shotton_WMDE renamed this task from Modify data of a property to ๐Ÿ—๏ธ Modify data of a property.Mar 11 2024, 3:01 PM

Summary from polishing: Mandatory field for property are id and data type. Missing field error is thrown only when data type is removed. We ignore if an id is removed, in alignment with what we're doing on statements.