This applies JSON Schema validation in phpunit tests where appropriate: 1) In ModuleSpecHandlerTest, the generated OpenApi specs are validated against the OpenAPI 3 schema. 2) In RestStructureTest, module definition files are validated against the mwapi schema. This patch introduces a new trait to make it easy for phpunit test cases to perform validation. This patch also fixes some issues with the docs/rest/mwapi-1.0.json schema and the includes/Rest/content.v1.json module definition. Change-Id: I966cddb337c9373ed3a369496548a8d8c538ae84
128 lines
2.4 KiB
JSON
128 lines
2.4 KiB
JSON
{
|
|
"mwapi": "1.0.0",
|
|
"moduleId": "content/v1",
|
|
"info": {
|
|
"version": "1.0",
|
|
"title": "Page content",
|
|
"description": "Provides access to the content and meta-data of pages and revisions"
|
|
},
|
|
"paths": {
|
|
"/page": {
|
|
"post": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\CreationHandler",
|
|
"services": [
|
|
"MainConfig",
|
|
"ContentHandlerFactory",
|
|
"TitleParser",
|
|
"TitleFormatter",
|
|
"RevisionStore"
|
|
],
|
|
"format": "source"
|
|
}
|
|
}
|
|
},
|
|
"/page/{title}": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\PageSourceHandler",
|
|
"services": [
|
|
"TitleFormatter",
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "source"
|
|
}
|
|
},
|
|
"put": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\UpdateHandler",
|
|
"services": [
|
|
"MainConfig",
|
|
"ContentHandlerFactory",
|
|
"TitleParser",
|
|
"TitleFormatter",
|
|
"RevisionStore"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"/page/{title}/html": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\PageHTMLHandler",
|
|
"services": [
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "html"
|
|
}
|
|
}
|
|
},
|
|
"/page/{title}/with_html": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\PageHTMLHandler",
|
|
"services": [
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "with_html"
|
|
}
|
|
}
|
|
},
|
|
"/page/{title}/bare": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\PageSourceHandler",
|
|
"services": [
|
|
"TitleFormatter",
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "bare"
|
|
}
|
|
}
|
|
},
|
|
"/revision/{id}": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\RevisionSourceHandler",
|
|
"services": [
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "source"
|
|
}
|
|
}
|
|
},
|
|
"/revision/{id}/html": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\RevisionHTMLHandler",
|
|
"services": [
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "html"
|
|
}
|
|
}
|
|
},
|
|
"/revision/{id}/with_html": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\RevisionHTMLHandler",
|
|
"services": [
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "with_html"
|
|
}
|
|
}
|
|
},
|
|
"/revision/{id}/bare": {
|
|
"get": {
|
|
"handler": {
|
|
"class": "MediaWiki\\Rest\\Handler\\RevisionSourceHandler",
|
|
"services": [
|
|
"PageRestHelperFactory"
|
|
],
|
|
"format": "bare"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|