Extension:GraphQL

From Linux Web Expert

MediaWiki extensions manual
GraphQL
Release status: experimental
File:MediaWiki GraphQL Logo.svg
Implementation API
Description GraphQL proxy for the Action API
Author(s) David Barratt (DBarratt (WMF)talk)
MediaWiki >= 1.35
License GNU General Public License 3.0 or later
Download
  • $wgGraphQLValidateSchema
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the GraphQL extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

GraphQL extension exposes a /graphql endpoint in MediaWiki as a proxy for the Action API and REST API.

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/GraphQL</tvar>|Download]] and move the extracted <tvar name=name>GraphQL</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GraphQL
  • <translate> Only when installing from Git, run <tvar name=composer>Composer</tvar> to install PHP dependencies, by issuing <tvar name=code>composer install --no-dev</tvar> in the extension directory.</translate> <translate> (See <tvar name=phab><translate> task <tvar name=1>T173141</tvar></translate></tvar> for potential complications.)</translate>
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'GraphQL' );
    
  • Install npm dependencies with npm install in the extension directory
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Usage

  • The GraphQL endpoint is exposed at Special:GraphQL with an alias at /graphql.
  • The GraphQL Sandbox can be accessed at Special:GraphQLSandbox. The sandbox uses the GraphiQL in-browser GraphQL IDE.
  • The federation service endpoint is exposed at Special:GraphQL/Federation with an alias at /graphql/federation.

Project Goals

  1. A proxy for the Action API and REST API. This extension should not expose functionality that is not already available in the existing APIs. This extension will therefore exist as a convenience to developers making bulk or recursive requests to the existing APIs.
  2. A federated service. This extension should be compatible with Apollo's Federation Specification or other federated specifications to allow a centralized gateway like Tool:GraphQL to make distributed GraphQL queries.