As a developer I want to be able to edit a Wikidata property
PATCH /entities/properties/{property_id}
**Acceptance criteria**
- Request includes a JSON Patch document describing wanted changes
- 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}/statements/{statement_id}
- Response to a success request will include the new statement data, inclduing 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}
**Error cases to consider**
<table>
<tr>
<th>
</th>
<th>HTTP response code</th>
<th>response payload</th>
</tr>
<tr>
<td>Property does not exist </td>
<td>404</td>
<td>
`"code": "property-not-found"`
`"message": "Could not find a property with the ID: {property_id}"`
</td>
</tr>
<tr>
<td>Invalid property ID </td>
<td>400</td>
<td>
`"code": "invalid-property-id"`
`"message": "Not a valid property ID: {property_id}"`
`"context": {"property-id": "{property-id}"}`
</td>
</tr>
<tr>
<td>Invalid edit tag</td>
<td>400</td>
<td>
`"code": "invalid-edit-tag"`
`"message": "Invalid MediaWiki tag: {tag}"`
</td>
</tr>
<tr>
<td>Edit comment/summary too long</td>
<td>400</td>
<td>
`"code": "comment-too-long"`
`"message": "Comment must not be longer than {limit} characters"`
</td>
</tr>
<tr>
<td>Request would change the ID of the property</td>
<td>400</td>
<td>
`"code": "invalid-operation-change-property-id"`
`"message": "Cannot change the ID of the existing property"`
</td>
</tr>
<tr>
<td>Missing a mandatory field in JSON Patch (e.g. "path", "op")</td>
<td>400</td>
<td>
`"code": "missing-json-patch-field"`
`"message": "Missing '{field}' in JSON patch"`
`"context": { "operation": { <PATCH_OBJECT> }, "field": <MISSING_FIELD> }`
</td>
</tr>
<tr>
<td>Operation in the JSON Patch is not valid</td>
<td>400</td>
<td>
`"code": "invalid-patch-operation"`
`"message": "Incorrect JSON patch operation: '{op}'"`
`"context": { "op": "{op}", path": "/some/path" }`
</td>
</tr>
<tr>
<td>Value provided in the JSON Patch operation is of incorrect type</td>
<td>400</td>
<td>
`"code": "invalid-patch-field-type"`
`"message": "The value of '{field}' must be of type string"`
`"context": { "operation": { <PATCH_OBJECT> }, "field": <FIELD> }`
</td>
</tr>
<tr>
<td>Provided JSON Patch document is not valid (generic error)</td>
<td>400</td>
<td>
`"code": "invalid-patch"`
`"message": "The provided patch is invalid"`
</td>
</tr>
<tr>
<td>Cannot apply JSON Patch as target path not found</td>
<td>409</td>
<td>
`"code": "patch-target-not-found"`
`"message": "Target '{target}' not found on the resource"`
`"context": { "operation": { <PATCH_OBJECT> }, "field": <PATH> }`
</td>
</tr>
<tr>
<td>Test operation of JSON Patch failed</td>
<td>409</td>
<td>
`"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> }`
</td>
</tr>
<tr>
<td>Request payload is not JSON</td>
<td>415</td>
<td>
`"code": "unsupported-content-type"`
`"message": "Unsupported Content-Type: '{content_type}'"`
</td>
</tr>
<tr>
<td>Property after changes missing mandatory field</td>
<td>422</td>
<td>
`"code": "patched-property-missing-field"`
`"message": "Mandatory field missing in the patched property: '{field}''"`
`"context": { "path": "{field}"}`
</td>
</tr>
<tr>
<td>Value in the property data after changes is invalid</td>
<td>422</td>
<td>
`"code": "patched-property-invalid-field"`
`"message": "Invalid input for '{field}' in the patched property"`
`"context": { "path": "{field}", "value": "{value}"}`
</td>
</tr>
<tr>
<td>Invalid edit tag</td>
<td>400</td>
<td>
`{ "code": "invalid-edit-tag", "message": "Invalid MediaWiki tag: {tag}" }`
</td>
</tr>
<tr>
<td>Comment too long</td>
<td>400</td>
<td>
`{"code": "comment-too-long", "message": "Comment must not be longer than {limit} characters"}`
</td>
</tr>
</table>
**Possibly relevant pointers:**
* - "Automated edit summary" related to the edit to be the same thing as for items
* How Wikibase Action API handles this: https://www.wikidata.org/w/api.php?action=help&modules=wbeditentity