Last modified: 2014-11-11 15:29:53 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 T68419, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 66419 - Move JS WikibaseAPI code into its own component
Move JS WikibaseAPI code into its own component
Status: ASSIGNED
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: High normal (vote)
: ---
Assigned To: Wikidata bugs
u=dev c=frontend p=8 s=2014-11-11
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-10 14:16 UTC by tobias.gritschacher
Modified: 2014-11-11 15:29 UTC (History)
5 users (show)

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


Attachments

Description tobias.gritschacher 2014-06-10 14:16:56 UTC
To reduce the JS code in WikibaseLib, create a new component and move the WikibaseAPI JS code there.
Comment 1 Adrian Lang 2014-07-10 13:48:13 UTC
Steps missing:
* Move wikibase.AbstractedRepoApi, wikibase.RepoApi to wikibase.api (not wikibase.RepoApiError!)
* (Optional: Remove mw dependency in wikibase.(api.)RepoApi by removing _logFailure)
* Move wikibase.api.* to own extension and git repository
Comment 2 Jeroen De Dauw 2014-09-23 23:03:07 UTC
\o/
Comment 3 Adrian Lang 2014-10-28 13:19:02 UTC
After a good amount of code restructuring, I now want to start on determining what actually belongs to this soon-to-be API module.
Comment 4 Adrian Lang 2014-11-05 13:23:34 UTC
From my point of view, the module could look like the following:

wikibase.api = {
  __namespace
  FormatValueCaller
  getLocationAgnosticMwApi
  ParseValueCaller
  RepoApi
  RepoApiError
}

wikibase.api.tests = {
  RepoApi
  RepoApiError
}

It would depend on the following resource loader modules:

* json
* mediawiki.api // For wikibase.api.getLocationAgnosticMwApi
* util.inherit
* wikibase // For the namespace

And use the following messages:

* wikibase-error-unexpected (also used by jquery.wikibase.linkitem and Wikibase\Lib\Localizer\GenericExceptionLocalizer)
* wikibase-error-save-generic
* wikibase-error-remove-generic
* wikibase-error-save-timeout
* wikibase-error-remove-timeout
* wikibase-error-ui-edit-conflict

Open questions / tasks:

* What to do with the shared message? Should we duplicate it and define our own version in the JavaScriptApi module, or should we use it without defining it?
* Move wb.RepoApi{,Error} to wb.api

What do you think, Henning, Tobi?
Comment 5 Henning 2014-11-05 13:32:17 UTC
I would not go for message dependencies across module borders--I would opt for duplicating the message.
Will there ever be something like wikibase.api.ClientApi and a ClientApiError or can we get rid of the "Repo" prefix?
Comment 6 Adrian Lang 2014-11-05 13:40:25 UTC
I thought the "Repo" would refer to the fact that it works on the API of the Repo.
Comment 7 Jeroen De Dauw 2014-11-05 14:30:52 UTC
> * wikibase // For the namespace

Where is that defined? If in wb.git, then we'll have a circular dependency no?

> I would not go for message dependencies across module borders--I would opt for duplicating the message.

Agree. Else you again create a dependency in the wrong direction. If you where to not duplicate them, then putting them in the component that the other one depends on is better.

> Will there ever be something like wikibase.api.ClientApi and a ClientApiError or can we get rid of the "Repo" prefix?

As Adrian noted, the software that provides to used web API is Wikibase Repository. Wikibase Client already has some web API and Wikibase Query will as well. Plus additional things part of Wikibase might have a web API at some point.

What you could of course do is make the interface of the component more abstract and no name it after the implementation of its interface. For instance, you could name it something like "entity store", if what it does is entity persistence. Since I do not know this code, I can't say if it makes sense to have this as public interface of this package, or rather have the interface in whatever talks to this component.
Comment 8 Adrian Lang 2014-11-05 14:34:28 UTC
Yes, right now we have circular dependencies with all our Wikibase JS components, because ›wikibase‹ is not just a namespace right now and can't be created on demand. I'm working on removing all properties and state from ›wikibase‹, though.
Comment 9 Adrian Lang 2014-11-06 09:24:10 UTC
Good news: with https://gerrit.wikimedia.org/r/171518, wikibase can be used as a namespace and everybody can just initialize it to an empty object if they need to.
Comment 10 Adrian Lang 2014-11-11 11:14:05 UTC
https://gerrit.wikimedia.org/r/172522 moves RepoApi to wb.api

Still have to do the message duplication and removal of dependency on 'wikibase' resource loader module.

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


Navigation
Links