aboutsummaryrefslogtreecommitdiffstats
path: root/docs/rest/mwapi-1.0.json
blob: 875964eaaf2bd9ca20dbd2a30a1f2a83ed1c9fbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{
	"$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
				}
			}
		}
	}
}