Last modified: 2014-06-30 13:37:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T65299, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63299 - Snak formatter should handle mismatches between Snak's DataType and actual type of the DataValue
Snak formatter should handle mismatches between Snak's DataType and actual ty...
Status: VERIFIED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
master
All All
: High normal (vote)
: ---
Assigned To: Wikidata bugs
u=dev c=backend p=5 s=2014-05-20
:
Depends on: 64995
Blocks: 62495
  Show dependency treegraph
 
Reported: 2014-03-31 13:22 UTC by Adrian Lang
Modified: 2014-06-30 13:37 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Adrian Lang 2014-03-31 13:22:57 UTC
DispatchingValueFormatter::getFormatter first searches a PT formatter, then a VT formatter. Currently, most of the mappings in WikibaseValueFormatterBuilders are VT, which means there is no error for type mismatches if the property has one of those types.

I have no clue if we should move most of the VT to PT mappings or change the logic or whatever. JS does this correctly.
Comment 1 Adrian Lang 2014-04-23 10:37:51 UTC
I discussed this with Daniel Kinzler. The desired behavior is as following:

(in PropertyValueSnakFormatter::formatSnak)
* Get data type for property
* Get expected data value type for property data type
* If expected data value type does not match actual data value type, add error to output (for widget html)
* look up formatter based on property data type if expected data value type matches actual data value type
* If no formatter found, look up formatter for actual data value type

Put together: Always format value, try to give error messages if there are mismatches.
Comment 2 Daniel Kinzler 2014-04-24 09:38:33 UTC
(In reply to Adrian Lang from comment #1)
> * If expected data value type does not match actual data value type, add
> error to output (for widget html)

Thinking about it, we'll need this also for wikitext output, for use on the client. So I suggest to make "include error info" a formatter option, so we can control whether error info is inlined in each context.

> * look up formatter based on property data type if expected data value type
> matches actual data value type
> * If no formatter found, look up formatter for actual data value type
> 
> Put together: Always format value, try to give error messages if there are
> mismatches.

Furthermore, if formatting of the DataValue for some other reason fails with an exception, the ValueSnakFormatter should catch that exception, log it (probably using wfWarn, not wfLogWarning), and optionally include it in the return value. In that case, use an ExceptionLocalizer to generate a human readable version of the error.
Comment 3 Gerrit Notification Bot 2014-05-06 08:13:42 UTC
Change 131665 had a related patch set uploaded by Aude:
Handle mismatching data type / values in snak formatter

https://gerrit.wikimedia.org/r/131665
Comment 4 Gerrit Notification Bot 2014-05-07 11:45:16 UTC
Change 131665 abandoned by Aude:
Handle mismatching data type / values in snak formatter

Reason:
will make more sense to sort out ExceptionLocalizer mess first and then split this in smaller patches

https://gerrit.wikimedia.org/r/131665
Comment 5 Gerrit Notification Bot 2014-05-14 17:59:21 UTC
Change 133286 had a related patch set uploaded by Daniel Kinzler:
Handle DVs that mismatch a prop's expected type

https://gerrit.wikimedia.org/r/133286
Comment 6 Gerrit Notification Bot 2014-05-22 15:43:54 UTC
Change 133286 merged by jenkins-bot:
Handle DVs that mismatch a prop's expected type

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links