Page MenuHomePhabricator

Missing cross references to JSON datamodel from Lua function documentation
Closed, ResolvedPublic

Description

On the mediawiki page [[mw:Extension:Wikibase Client/Lua]], the table serialization of statement and snak functions is not explained properly. This is specially confusing for beginners, who wonder how the table they get with the statement functions is built up. Also, they do not get the serialization used for snak functions. They do not know about the json serialization ([[mw:Wikibase/DataModel/JSON]]), which is what the table contains and thus get stuck.

This was explained properly in revision [[mw:Special:Redirect/revision/915272]], not that I expect the whole serialization to be displayed on that page, but it should give an idea where I am going.

In this bug, the documentation for the following functions should answer the question of how the table that is returned is built up (in the case of the statement functions) and mention how the serialization for snaks is built up (for the snak functions). Also, there should be a prominent link to the JSON data-model. An link to the json data-model at the end, like it is currently, is not sufficient. Those two fixes is what this bug covers and nothing else.

mw.wikibase.renderSnak
mw.wikibase.formatValue
mw.wikibase.renderSnaks
mw.wikibase.formatValues
mw.wikibase.getBestStatements
mw.wikibase.getAllStatements

Event Timeline

Snaevar created this task.Mar 29 2018, 9:01 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 29 2018, 9:01 PM
hoo added a subscriber: hoo.Apr 2 2018, 2:12 PM
hoo added a subscriber: Multichill.Apr 5 2018, 10:26 PM

Change 424598 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Wikibase@master] Lua: Explain Entity and Statement format

https://gerrit.wikimedia.org/r/424598

hoo claimed this task.Apr 9 2018, 10:11 AM

Change 424598 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Lua: Explain Entity and Statement format

https://gerrit.wikimedia.org/r/424598

It is now explained how entities / statements obtained look like, both by linking to specific documentation and by providing an example.

I'm not sure what to do regarding the formatter functions… people are not supposed to manually construct Snaks to use here, but they can obtain them from retrieved (parts of) entities.

hoo moved this task from Incoming to To do next on the Wikibase-Lua board.Apr 12 2018, 1:56 PM

Can we close this task? Otherwise, if there’s still some documentation left to be added, it should not be in the “done” column.

hoo closed this task as Resolved.Jun 5 2018, 1:31 PM

As the reporter didn't reply I think we can consider this good enough for now.