Wikibase
MediaWiki Wikibase extension
|
To enable the production-ready routes, add the following line to your LocalSettings.php
file:
To enable routes in development (not recommended for production use), also add:
Our REST API specification is provided using an OpenAPI specification in the specs
directory. The latest version is published on doc.wikimedia.org.
The specification can be "built" (i.e., compiled into a single JSON OpenAPI specs file) and validated using the provided npm scripts.
To modify API specs, install npm dependencies first, using a command like the following:
API specs can be validated using the npm test
script, using a command like the following:
API specs can be bundled into a single file using the npm build:spec
script, using a command like the following:
Autodocs can be generated from the API specification using the npm build:docs
script, using a command like the following:
The autodocs and the bundled OpenAPI specification files are generated in the ../../docs/rest-api/
directory.
This REST API follows the Hexagonal Architecture approach and takes inspiration from an article about Netflix's use of the hexagonal architecture. This decision is documented in ADR 0001.
docs/
../../docs/rest-api/
: the built OpenAPI specification and swagger documentationspecs/
: OpenAPI specification sourcesrc/
DataAccess/
: implementations of services that bind to persistent storageDomain/
: domain models and servicesPresentation/
: presenter and converter classes to manipulate the output as part of the transport layerRouteHandlers/
classes that create and pass request DTO into use cases and return HTTP responsesUseCases/
: one directory per use casetests/
mocha/
: tests using the mocha frameworkapi-testing/
: end-to-end tests using MediaWiki's api-testing libraryopenapi-validation/
: tests against the OpenAPI specphpunit/
: integration and unit tests using the phpunit frameworkThese tests can be run with the command npm run api-testing
. They require the targeted wiki to act as both client and repo, so that Items can have sitelinks to pages on the same wiki.