wiki.techinc.nl/docs/rest/mwapi-1.0.json
daniel 84fe1b9ccd REST: Introduce discovery endpoint
The discovery endpoint provides basic information about accessing the
wiki's APIs, as well as a directory of available modules.

Bug: T365753
Change-Id: I161aa68566da91867b650e13c8aadc87cd0c428c
2024-09-20 17:02:59 +00:00

127 lines
3.5 KiB
JSON

{
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "https://www.mediawiki.org/schema/mwapi-1.0",
"title": "MediaWiki REST API module definition",
"description": "Module definition files provide meta-data about modules and define the available routes. They are similar to OpenAPI specs.",
"type": "object",
"required": [ "mwapi", "info", "moduleId", "paths" ],
"properties": {
"mwapi": {
"description": "The version of the MediaWiki module definition schema used by the document.",
"type": "string"
},
"moduleId": {
"description": "The module name, also used as the path prefix",
"type": "string"
},
"info": {
"$ref": "#/definitions/Info"
},
"paths": {
"description": "Information about the API routes available for interacting with the wiki.",
"type": "object",
"minProperties": 1,
"additionalProperties": { "$ref": "#/definitions/Path" }
}
},
"definitions": {
"Info": {
"allOf": [
{ "$ref": "https://spec.openapis.org/oas/3.0/schema/2021-09-28#/definitions/Info" },
{ "$ref": "#/definitions/ExtraInfo" }
]
},
"ExtraInfo": {
"type": "object"
},
"Path": {
"title": "REST API Path",
"description": "The operations available for a given path",
"type": "object",
"minProperties": 1,
"additionalProperties": { "$ref": "#/definitions/Operation" }
},
"Operation": {
"allOf": [
{ "$ref": "#/definitions/OperationInfo" },
{ "$ref": "#/definitions/OperationImpl" }
]
},
"OperationInfo": {
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"summary": {
"type": "string"
},
"description": {
"type": "string"
},
"externalDocs": {
"$ref": "https://spec.openapis.org/oas/3.0/schema/2021-09-28#/definitions/ExternalDocumentation"
}
}
},
"OperationImpl": {
"oneOf": [
{ "$ref": "#/definitions/WithHandler" },
{ "$ref": "#/definitions/WithRedirect" }
]
},
"WithHandler": {
"required": [ "handler" ],
"properties": {
"handler": {
"$ref": "#/definitions/MWObjectSpec"
}
}
},
"MWObjectSpec": {
"type": "object",
"description": "An object-spec for use with the wikimedia/object-factory package.",
"properties": {
"class": {
"type": "string",
"description": "PHP class name of the object to create. If 'factory' is also specified, it will be used to validate the object."
},
"factory": {
"type": [ "string", "array" ],
"description": "Factory method for creating the object (a PHP callable)."
},
"args": {
"type": "array",
"description": "Arguments to pass to the constructor or the factory method."
},
"services": {
"type": "array",
"item": { "type": "string" },
"description": "List of services to pass as arguments. Each name will be looked up in MediaWikiServices."
},
"optional_services": {
"type": "array",
"item": { "type": "string" },
"description": "List of services to pass as arguments. Each name will be looked up in MediaWikiServices. If the service is unknown the parameter is set to 'null' instead of causing an error."
}
},
"additionalProperties": true
},
"WithRedirect": {
"required": [ "redirect" ],
"properties": {
"redirect": {
"type": "object",
"required": [ "path" ],
"properties": {
"path": { "type": "string" },
"code": { "type": "integer" }
},
"additionalProperties": false
}
}
}
}
}