Import silently dropping fields

12 views
Skip to first unread message

Emiliano Heyns

unread,
Jan 11, 2018, 7:03:33 PM1/11/18
to zotero-dev
If I'm not mistaken, the data gathered by import translators is handed off to Zotero.Item.prototype.fromJSON to prepare the new item. In this method, fields that are not valid for the type are silently dropped; would it be possible to either get back some kind of indication that this happened in the importer, or even that an importer could cause an error to be thrown when this happens? I understand why the importer infrastructure would want to be lenient, but when I'm running my test suite, I'd rather had it be harsh so I can correct this. My importer should not be offering items which will on import have part of their data dropped.

Dan Stillman

unread,
Jan 11, 2018, 7:25:48 PM1/11/18
to zoter...@googlegroups.com
I don't totally understand the problem. Presumably you're testing the
items that result from the import process, and when you set that up
you'll know it's not skipping data. So if some data ended up missing,
that would already show up in your tests, no?

In any case, those messages are logged, so you could just check for
those messages from Zotero.getErrors().

Emiliano Heyns

unread,
Jan 11, 2018, 7:31:54 PM1/11/18
to zotero-dev
On Friday, January 12, 2018 at 1:25:48 AM UTC+1, Dan Stillman wrote:
On 1/11/18 7:03 PM, Emiliano Heyns wrote:

I don't totally understand the problem. Presumably you're testing the
items that result from the import process, and when you set that up
you'll know it's not skipping data. So if some data ended up missing,
that would already show up in your tests, no?


It should, but by inspecting the logs from an incoming error report, I now just noticed I was putting the data for some input in the wrong field. I probably had not imported this field before -- since Zotero is checking these fields anyway, I'd love to have that as a quality assurance in my own tests to prevent regression.
 
In any case, those messages are logged, so you could just check for
those messages from Zotero.getErrors().

Possible, true, but I'd rather not have to parse the log during my tests.

If not desirable to add I'll just copy the code from fromJSON to add them to my test run. 
Reply all
Reply to author
Forward
0 new messages