Last modified: 2014-10-13 22:31:52 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 T64905, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62905 - It should be possible to specify that APIs are internal and shouldn't be documented in api.php's output
It should be possible to specify that APIs are internal and shouldn't be docu...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.23.0
All All
: Normal normal (vote)
: ---
Assigned To: Brad Jorsch
:
Depends on:
Blocks: 62452
  Show dependency treegraph
 
Reported: 2014-03-21 00:30 UTC by James Forrester
Modified: 2014-10-13 22:31 UTC (History)
8 users (show)

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


Attachments

Description James Forrester 2014-03-21 00:30:22 UTC
For example, action=visualeditor is an internal API for the VisualEditor client to talk to its server, isn't really useful for third parties, and isn't remotely stable. However, because it's a built-in assumption that APIs are for third-party use rather than every tool being the first client of its API, this isn't possible. Boo.
Comment 1 Bawolff (Brian Wolff) 2014-03-21 01:06:16 UTC
Maybe we should have not deprecated the ajax interface.
Comment 2 Brad Jorsch 2014-03-21 14:02:38 UTC
Brainstorming:

Add a method, something like "isInternalApi", to ApiBase that by default returns false.

Add a boolean "includeinternal" parameter to ApiHelp, which when specified would include these internal API modules.

Adjust ApiBase::makeHelpMsg() to take a boolean indicating whether internal API modules should be shown (i.e. whether "includeinternal" was given to action=help).

Then ApiHelp::execute(), if not passed a "modules" parameter explicitly, would check the flag and isInternalApi() to decide whether to include each module in the output. Modules like ApiQuery that have submodules would use the new parameter to their ::makeHelpMsg() methods to do the same.

The help output should also include indication of whether a module is internal, much like it now does for stuff like "This module only accepts POST requests".

I'm not sure whether we should also try to adjust the output of getAllowedParams() to omit these internal modules from the valid values for "action", or if that would be too expensive for too little gain (if we did do that, we'd need to do like how ApiPageSet handles generators). We certainly should be sure not to omit the internal modules for action=paraminfo though.


(In reply to James Forrester from comment #0)
> For example, action=visualeditor is an internal API for the VisualEditor
> client to talk to its server, isn't really useful for third parties, and
> isn't remotely stable. However, because it's a built-in assumption that APIs
> are for third-party use rather than every tool being the first client of its
> API, this isn't possible. Boo.

Ideally a tool's API would be perfectly usable by third parties, not something overly specific to the one tool's internal implementation, although that may not always be possible. I don't know which is the case for VE's API or if it's just that it's not yet stable.
Comment 3 James Forrester 2014-03-21 14:57:08 UTC
(In reply to Brad Jorsch from comment #2)
> (In reply to James Forrester from comment #0)
> > For example, action=visualeditor is an internal API for the VisualEditor
> > client to talk to its server, isn't really useful for third parties, and
> > isn't remotely stable. However, because it's a built-in assumption that APIs
> > are for third-party use rather than every tool being the first client of its
> > API, this isn't possible. Boo.
> 
> Ideally a tool's API would be perfectly usable by third parties, not
> something overly specific to the one tool's internal implementation,
> although that may not always be possible. I don't know which is the case for
> VE's API or if it's just that it's not yet stable.

Completely agreed in the general case that we should encourage tools to create APIs that are useful for third parties. VE, as an exclusive consumer of APIs, comes up against the problem of the existing APIs in MW and extensions not actually providing the necessary features — we're well aware of how bad this is in some areas! My view is that all tools, core and otherwise, should be expected to be the first client of their own, normally public API rather than magically and silently reach into the codebase to make changes that other tools cannot (EditPage.php, I'm looking at you).

With VE's API, it's a combination of:

* not yet sufficiently stable (new features and formats being added each week or so),
* not a long-term prospect (this exists mostly to code around a lack of genericness in MW, and eventually we'll fix that rather than keep this), and
* not being a 'real' API (much of the content of the API is available from other API calls, but having a single call improves efficiency for VE's client).

As an illustrated example, see this change made this week to VE's API to add hinting to links that don't exist (so VE can add red colouring): https://gerrit.wikimedia.org/r/#/c/118045/14/ApiVisualEditor.php

This:
* changed just yesterday,
* is intended to be replaced reasonably soon with a proper Parsoid post-processor to sit in front of the HTML+RDFa cache for making changes that are currently parser cache-busting like this, and
* is trivially something that can be provided by the pre-existing public APIs.
Comment 4 Gerrit Notification Bot 2014-09-04 23:46:45 UTC
Change 158546 had a related patch set uploaded by Alex Monk:
Make it possible for API modules to hide their documentation behind an 'includeinternal' parameter

https://gerrit.wikimedia.org/r/158546
Comment 5 Gerrit Notification Bot 2014-09-16 19:26:55 UTC
Change 160798 had a related patch set uploaded by Anomie:
API: HTMLize and internationalize the help, add Special:ApiHelp

https://gerrit.wikimedia.org/r/160798
Comment 6 Gerrit Notification Bot 2014-10-10 08:16:40 UTC
Change 158546 abandoned by Legoktm:
API: Implement concept of 'internal' API modules

Reason:
Superseded by Ib14c00df06d85c2f6364d83b2b10ce34c7f513cc

https://gerrit.wikimedia.org/r/158546
Comment 7 James Forrester 2014-10-10 19:24:31 UTC
Taken over by Brad.
Comment 8 Gerrit Notification Bot 2014-10-13 22:20:01 UTC
Change 160798 merged by jenkins-bot:
API: HTMLize and internationalize the help, add Special:ApiHelp

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

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


Navigation
Links