It perhaps makes sense for a call to `/w/api.php?action=query&format=json&prop=info&titles=Test&formatversion=2&inprop=watchlistlabels` to return an array of watchlist labels (IDs? IDs and names?) for the given page
Relates to {T416615}
---
**Derived Requirements**
1. The `action=query&prop=info` API must support a new `inprop` value: `watchlistlabels`.
2. When `inprop=watchlistlabels` is specified and the page is watched by the current user:
* The response must include an array of watchlist labels assigned to that page.
* Each label must include:
* Label ID
* Label name
* The structure must align with the existing watchlist label format used elsewhere in the API (consistent schema and field naming).
3. If the page has no labels assigned:
* The API must return an empty array for `watchlistlabels` (not omit the field).
4. If the page is not watched:
* The API must either omit the field or return an empty array (behavior must be consistent and documented).
5. The response must respect user permissions:
* Only return labels for the authenticated user making the request.
6. The feature must work with `format=json` and `formatversion=2`.
==== Test Steps
### Test Case 1: API returns labels for a watched page with labels
1. Watch a page in Beta.
2. Assign one or more watchlist labels to the page.
3. Call: https://en.wikipedia.beta.wmcloud.org/w/api.php?action=query&format=json&formatversion=2&inprop=watchlistlabels&prop=info&titles=Banana
4. Inspect the JSON response.
5. ✅❓❌⬜ **AC1:** Response includes a `watchlistlabels` array under the page object, contains each label entry contains both ID and name, also returned labels match those assigned in the UI .
### Test Case 2: API returns empty array when page has no labels
1. Watch a page in Beta.
2. Ensure no labels are assigned.
3. Call the same API endpoint with `inprop=watchlistlabels`.
4. Inspect the JSON response.
5. ✅❓❌⬜ **AC2:** `watchlistlabels` is present and is an empty array.
### Test Case 3: API behavior for unwatched page
1. Ensure a page is not on the watchlist in Beta.
2. Call the API with `inprop=watchlistlabels`.
3. Inspect the JSON response.
4. ✅❓❌⬜ **AC3:** watchlistlabels` is present and is an empty array.
### Test Case 4: API without inprop parameter
1. Call: https://en.wikipedia.beta.wmcloud.org/w/api.php?action=query&format=json&formatversion=2&prop=info&titles=Banana
2. Inspect the JSON response.
3. ✅❓❌⬜ **AC4:** No `watchlistlabels` field is present when `inprop=watchlistlabels` is not specified.
### Test Case 5: Permission check
1. Log out or use a user without the page on their watchlist.
2. Call the API with `inprop=watchlistlabels`.
3. ✅❓❌⬜ **AC5:** Labels are not returned for another user’s watchlist.