[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Add response definitions to spec for feed endpoints
jenkins-bot has submitted this change and it was merged. Change subject: Add response definitions to spec for feed endpoints .. Add response definitions to spec for feed endpoints Additional schema checks using these will be added in the next patch in this series (note that the existing checks only validate the spec examples and these additional checks will give us more flexibility, e.g., to check that failing requests, for which we don't necessarily want to create examples, fail in the right way). Also added some blank lines for readability. Bug: T145075 Change-Id: I6331a18f4b13ff7864ec73c969fd86d3e9ce732c --- M spec.yaml 1 file changed, 258 insertions(+), 0 deletions(-) Approvals: BearND: Looks good to me, approved jenkins-bot: Verified diff --git a/spec.yaml b/spec.yaml index c3acd69..a3aa248 100644 --- a/spec.yaml +++ b/spec.yaml @@ -1,4 +1,5 @@ swagger: '2.0' + info: version: 0.1.0 title: WMF MobileApps service @@ -10,8 +11,10 @@ license: name: Apache2 url: http://www.apache.org/licenses/LICENSE-2.0 + x-default-params: domain: en.wikipedia.org + paths: # from routes/root.js /robots.txt: @@ -21,6 +24,7 @@ - Robots description: Gets robots.txt x-monitor: false + /: get: tags: @@ -35,6 +39,7 @@ spec: true response: status: 200 + # from routes/info.js /_info: get: @@ -55,6 +60,7 @@ description: /.+/ version: /.+/ home: /.+/ + # from routes/featured.js /{domain}/v1/page/featured/{}/{mm}/{dd}: get: @@ -85,6 +91,31 @@ required: true minimum: "01" maximum: "31" + responses: +'200': + description: The title of a Wikipedia's Featured Article of the Day + schema: +$ref: '#/definitions/article_title' +'204': + description: Empty response (for feed content aggregation requests from RESTBase) + schema: +$ref: '#/definitions/empty' +'404': + description: Not found + schema: +$ref: '#/definitions/problem' +'500': + description: API Error + schema: +$ref: '#/definitions/problem' +'501': + description: Unsupported language + schema: +$ref: '#/definitions/problem' +default: + description: Error + schema: +$ref: '#/definitions/problem' x-amples: - title: retrieve title of the featured article for April 29, 2016 request: @@ -110,6 +141,7 @@ response: status: 204 body: "" + # from routes/featured-image.js /{domain}/v1/media/image/featured/{}/{mm}/{dd}: get: @@ -140,6 +172,23 @@ required: true minimum: "01" maximum: "31" + responses: +'200': + description: Info on the Commons Featured Image of the Day for the requested date + schema: +$ref: '#/definitions/image' +'204': + description: Empty response (for feed content aggregation requests from RESTBase) + schema: +$ref: '#/definitions/empty' +'404': + description: Not found (no featured image for the requested date) + schema: +$ref: '#/definitions/problem' +default: + description: Error + schema: +$ref: '#/definitions/problem' x-amples: - title: retrieve featured image data for April 29, 2016 request: @@ -164,6 +213,7 @@ source: /.+/ width: /.+/ height: /.+/ + # from routes/most-read.js /{domain}/v1/page/most-read/{}/{mm}/{dd}: get: @@ -194,6 +244,23 @@ required: true minimum: "01" maximum: "31" + responses: +'200': + description: Most-read article titles for this wiki for the requested date + schema: +$ref: '#/definitions/mostread' +'204': + description: Empty response (for feed content aggregation requests from RESTBase) + schema: +$ref: '#/definitions/empty' +'404': + description: No data found for the requested date + schema: +$ref: '#/definitions/problem' +default: + description: Error + schema: +$ref: '#/definitions/problem' x-amples: - title: retrieve the most-read articles for January 1, 2016 request: @@ -240,6 +307,7 @@ response: status: 204 body: "" + # from routes/random.js /{domain}/v1/page/random/title: get: @@ -248,6 +316,19 @@ description: Gets the title of a randomly picked article from main namespace. Preference
[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Add response definitions to spec for feed endpoints
Mholloway has uploaded a new change for review. https://gerrit.wikimedia.org/r/315995 Change subject: Add response definitions to spec for feed endpoints .. Add response definitions to spec for feed endpoints Additional schema checks using these will be added in the next patch in this series (note that the existing checks only validate the spec examples and these additional checks will give us more flexibility, e.g., to check that failing requests, for which we don't necessarily want to create examples, fail in the right way). Also added some blank lines for readability. Bug: T145075 Change-Id: I6331a18f4b13ff7864ec73c969fd86d3e9ce732c --- M spec.yaml 1 file changed, 202 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps refs/changes/95/315995/1 diff --git a/spec.yaml b/spec.yaml index c3acd69..aa9ef92 100644 --- a/spec.yaml +++ b/spec.yaml @@ -1,4 +1,5 @@ swagger: '2.0' + info: version: 0.1.0 title: WMF MobileApps service @@ -10,8 +11,10 @@ license: name: Apache2 url: http://www.apache.org/licenses/LICENSE-2.0 + x-default-params: domain: en.wikipedia.org + paths: # from routes/root.js /robots.txt: @@ -21,6 +24,7 @@ - Robots description: Gets robots.txt x-monitor: false + /: get: tags: @@ -35,6 +39,7 @@ spec: true response: status: 200 + # from routes/info.js /_info: get: @@ -55,6 +60,7 @@ description: /.+/ version: /.+/ home: /.+/ + # from routes/featured.js /{domain}/v1/page/featured/{}/{mm}/{dd}: get: @@ -85,6 +91,17 @@ required: true minimum: "01" maximum: "31" + responses: +'200': + description: The title of a Wikipedia's Featured Article of the Day + schema: +$ref: '#/definitions/article_title' +'204': + description: Empty response (for feed content aggregation requests from RESTBase) +default: + description: Error + schema: +$ref: '#/definitions/problem' x-amples: - title: retrieve title of the featured article for April 29, 2016 request: @@ -110,6 +127,7 @@ response: status: 204 body: "" + # from routes/featured-image.js /{domain}/v1/media/image/featured/{}/{mm}/{dd}: get: @@ -140,6 +158,17 @@ required: true minimum: "01" maximum: "31" + responses: +'200': + description: Info on the Commons Featured Image of the Day for the requested date + schema: +$ref: '#/definitions/image' +'204': + description: Empty response (for feed content aggregation requests from RESTBase) +default: + description: Error + schema: +$ref: '#/definitions/problem' x-amples: - title: retrieve featured image data for April 29, 2016 request: @@ -164,6 +193,7 @@ source: /.+/ width: /.+/ height: /.+/ + # from routes/most-read.js /{domain}/v1/page/most-read/{}/{mm}/{dd}: get: @@ -194,6 +224,17 @@ required: true minimum: "01" maximum: "31" + responses: +'200': + description: Most-read article titles for this wiki for the requested date + schema: +$ref: '#/definitions/mostread' +'204': + description: Empty response (for feed content aggregation requests from RESTBase) +default: + description: Error + schema: +$ref: '#/definitions/problem' x-amples: - title: retrieve the most-read articles for January 1, 2016 request: @@ -240,6 +281,7 @@ response: status: 204 body: "" + # from routes/random.js /{domain}/v1/page/random/title: get: @@ -248,6 +290,15 @@ description: Gets the title of a randomly picked article from main namespace. Preference is given to articles with a thumbnail, long extract, and an associated Wikidata description. produces: - application/json + responses: +'200': + description: A random (good) article title + schema: +$ref: '#/definitions/random' +default: + description: Error + schema: +$ref: '#/definitions/problem' x-amples: - title: retrieve a random article response: @@ -257,6 +308,7 @@ body: items: - title: /.+/ + # from routes/news.js /{domain}/v1/page/news: get: @@ -265,6 +317,17 @@ description: Gets content related to the current In the News template (experimental, English-only)