Zache created this task.
Zache added projects: SDC General, Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  **Steps to replicate the issue** (include links if applicable):
  
  - Find File with labels but without any statements (ie. mediainfo exists, but 
there is no statements)
  - Query File with API and with JSON output
  
  **What happens?**:
  
  - Example request:  
https://commons.wikimedia.org/w/api.php?action=wbgetentities&format=json&ids=M34247901&formatversion=2
  
  Result type of empty `statements` is `[]` (a **list**) .  In Wikidata type of 
empty values is `{}`(**dictionary**)
  
    {
        "entities": {
            "M34247901": {
                "pageid": 34247901,
                "ns": 6,
                "title": "File:Crater Barabashov based on day THEMIS.png",
                "lastrevid": 793186644,
                "modified": "2023-08-15T10:56:28Z",
                "type": "mediainfo",
                "id": "M34247901",
                "labels": {
                    "en": {
                        "language": "en",
                        "value": "Image of Barabashov crater on Mars."
                    },
                    "cs": {
                        "language": "cs",
                        "value": "Snímek kráteru Barabashov na povrchu Marsu."
                    }
                },
                "descriptions": {},
                "statements": []
            }
        },
        "success": 1
    }
  
  **What should have happened instead?**:
  Value of empty `statements` should be empty dictionary: `{}`
  
  Example request from Wikidata: 
https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&ids=Q121462814&formatversion=2
  
    {
        "entities": {
            "Q121462814": {
                "pageid": 115877382,
                "ns": 0,
                "title": "Q121462814",
                "lastrevid": 1954259543,
                "modified": "2023-08-15T10:42:10Z",
                "type": "item",
                "id": "Q121462814",
                "labels": {
                    "de": {
                        "language": "de",
                        "value": "A selection from the collection of drawings 
by the old masters formed"
                    }
                },
                "descriptions": {
                    "de": {
                        "language": "de",
                        "value": "1905"
                    }
                },
                "aliases": {},
                "claims": {},
                "sitelinks": {}
            }
        },
        "success": 1
    }
  
  **Other information** (browser name/version, screenshots, etc.):
  Incorrect type breaks in the pywikibot stable branch 8.3.0.

TASK DETAIL
  https://phabricator.wikimedia.org/T344237

WORKBOARD
  https://phabricator.wikimedia.org/project/board/34/

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Zache
Cc: Aklapper, pywikibot-bugs-list, Zache, PotsdamLamb, GFontenelle_WMF, 
Jyoo1011, FRomeo_WMF, JohnsonLee01, SHEKH, Dijkstra, CBogen, Khutuck, 
Nintendofan885, Zkhalido, Viztor, JKSTNK, Wenyi, Lahi, E1presidente, 
Ramsey-WMF, Cparle, SandraF_WMF, Tbscho, MayS, Tramullas, Acer, Salgo60, 
Mdupont, JJMC89, Silverfish, Dvorapa, Altostratus, Avicennasis, Susannaanas, 
Fuzheado, mys_721tx, Jane023, Wikidata-bugs, Xqt, Base, matthiasmullie, 
Daniel_Mietchen, jayvdb, Ricordisamoa, Wesalius, Lydia_Pintscher, Raymond, 
Masti, Alchimista, Steinsplitter
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to