maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
223 stars 24 forks source link

update-claim fails with some reference #130

Closed rwst closed 3 years ago

rwst commented 3 years ago

Here it looks a month value (instead of day) in the reference "retrieved" cannot be handled:

ralf@ark:~/wikidata> wd uc -b -s add-inchi-prefix <ttt
edit group: https://tools.wmflabs.org/editgroups/b/wikibase-cli/b464008393a6d/
processing line 1: Q15708304$EB01560B-FE7F-4360-B2BE-B266EE5BE449 InChi=1S/C23H32N2O/c1-22(2)21(23(22,3)4)20(26)18-15-25(19-12-7-6-11-17(18)19)14-16-10-8-9-13-24(16)5/h6-7,11-12,15-16,21H,8-10,13-14H2,1-5H3
{ modification-failed: modification-failed: Data value corrupt: $timestamp must resemble ISO 8601, given +2018-04-15T00:00:00Z-00
    at requestError (/usr/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/request/insistent_req.js:72:15)
    at parseBody (/usr/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/request/insistent_req.js:65:33)
    at process._tickCallback (internal/process/next_tick.js:68:7)
url: https://www.wikidata.org/w/api.php?action=wbeditentity&format=json&bot=true
response status: 200
response body: {"error":{"code":"modification-failed","info":"Data value corrupt: $timestamp must resemble ISO 8601, given +2018-04-15T00:00:00Z-00","messages":[{"name":"wikibase-validator-bad-value","parameters":["$timestamp must resemble ISO 8601, given +2018-04-15T00:00:00Z-00"],"html":{"*":"Data value corrupt: $timestamp must resemble ISO 8601, given +2018-04-15T00:00:00Z-00"}}],"*":"See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes."},"servedby":"mw2244"}
  name: 'modification-failed',
  statusCode: 200,
  statusMessage: undefined,
  headers:
   Headers {
     [Symbol(map)]:
      [Object: null prototype] {
        date: [ 'Fri, 18 Sep 2020 15:59:20 GMT' ],
        server: [ 'mw2244.codfw.wmnet' ],
        'x-content-type-options': [ 'nosniff' ],
        'mediawiki-api-error': [ 'modification-failed' ],
        'x-frame-options': [ 'DENY' ],
        'content-disposition': [ 'inline; filename=api-result.json' ],
        'cache-control': [ 'private, must-revalidate, max-age=0' ],
        vary: [ 'Accept-Encoding' ],
        'x-request-id': [ '7ea6eb7d-bcdb-4783-b385-24dc74fc45f3' ],
        'content-type': [ 'application/json; charset=utf-8' ],
        'content-encoding': [ 'gzip' ],
        age: [ '0' ],
        'x-cache': [ 'cp3056 miss, cp3058 pass' ],
        'x-cache-status': [ 'pass' ],
        'server-timing': [ 'cache;desc="pass"' ],
        'strict-transport-security': [ 'max-age=106384710; includeSubDomains; preload' ],
        'set-cookie':
         [ 'WMF-Last-Access=18-Sep-2020;Path=/;HttpOnly;secure;Expires=Tue, 20 Oct 2020 12:00:00 GMT',
           'WMF-Last-Access-Global=18-Sep-2020;Path=/;Domain=.wikidata.org;HttpOnly;secure;Expires=Tue, 20 Oct 2020 12:00:00 GMT',
           'GeoIP=DE:BE:Berlin:52.50:13.62:v4; Path=/; secure; Domain=.wikidata.org' ],
        'x-client-ip': [ '91.64.216.187' ],
        'accept-ranges': [ 'bytes' ],
        'content-length': [ '353' ],
        connection: [ 'keep-alive' ] } },
  body:
   { error:
      { code: 'modification-failed',
        info:
         'Data value corrupt: $timestamp must resemble ISO 8601, given +2018-04-15T00:00:00Z-00',
        messages:
         [ { name: 'wikibase-validator-bad-value',
             parameters:
              [ '$timestamp must resemble ISO 8601, given +2018-04-15T00:00:00Z-00' ],
             html:
              { '*':
                 'Data value corrupt: $timestamp must resemble ISO 8601, given +2018-04-15T00:00:00Z-00' } } ],
        '*':
         'See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.' },
     servedby: 'mw2244' },
  url:
   'https://www.wikidata.org/w/api.php?action=wbeditentity&format=json&bot=true' }
maxlath commented 3 years ago

wikibase-edit was confused by the precision=10 (month precision) at another format than yyyy-mm, that's now patched, and updated in wikibase-cli v15.2.3. I could run the edit successfully

rwst commented 3 years ago

Confirmed it works. Thanks again.