Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389876 )

Change subject: Update swagger spec with the media endpoint updates
......................................................................

Update swagger spec with the media endpoint updates

Change-Id: I196429595a1a21099a812edb709de00b7a617098
---
M spec.yaml
M test/features/app/spec.js
2 files changed, 70 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps 
refs/changes/76/389876/1

diff --git a/spec.yaml b/spec.yaml
index 164553d..57ae0d2 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -568,6 +568,15 @@
       description: Gets the images and videos which appear on a given wiki page
       produces:
         - application/json
+      responses:
+        '200':
+          description: All media items from a wiki page
+          schema:
+            $ref: '#/definitions/media_list'
+        default:
+          description: Error
+          schema:
+            $ref: '#/definitions/problem'
       x-amples:
         - title: retrieve images and videos of en.wp Cat page via media route
           request:
@@ -581,8 +590,12 @@
               items:
                 - title: /.+/
                   url: /.+/
+                  thumbUrl: /.+/
+                  mime: /.+/
                   width: /.+/
                   height: /.+/
+                  size: /.+/
+                  ext: /.+/
 
   # from routes/definition.js
   /{domain}/v1/page/definition/{title}:
@@ -1008,6 +1021,58 @@
       - size
       - timestamp
 
+  media_list:
+    type: object
+    properties:
+      items:
+        type: array
+        description: a list of media items
+        items:
+          $ref: '#/definitions/media_item'
+    required:
+      - items
+
+  media_item:
+    type: object
+    properties:
+      title:
+        type: string
+        description: the prefixed DB title for the item
+      url:
+        type: string
+        description: the content URL for the original item
+      thumbUrl:
+        type: string
+        description: the URL for a thumbnail of the original item
+      mime:
+        type: string
+        description: the MIME type
+      width:
+        type: integer
+        description: the original width
+      height:
+        type: integer
+        description: the original height
+      size:
+        type: integer
+        description: the original file size (sizes are not provide for video 
derivatives)
+      derivatives:
+        type: array
+        description: a list of alternately encoded derivatives of the original 
file (applies only to videos)
+      ext:
+        type: object
+        description: extended metadata about the object (provided by the 
CommonsMetadata extension)
+    required:
+      - title
+      - url
+      - thumbUrl
+      - mime
+      - width
+      - height
+      - size
+      - derivatives
+      - ext
+
   action:
     type: object
     properties:
diff --git a/test/features/app/spec.js b/test/features/app/spec.js
index e482ffe..4cfde1f 100644
--- a/test/features/app/spec.js
+++ b/test/features/app/spec.js
@@ -354,6 +354,11 @@
             return assertValidSchema(uri, '#/definitions/onthisdayResponse');
         });
 
+        it('media response should conform to schema', () => {
+            const uri = `${baseUri}page/media/Hummingbird`;
+            return assertValidSchema(uri, '#/definitions/media_list');
+        });
+
         // Bad requests return empty response for aggregated=true
 
         it('featured article response should conform to schema (invalid lang, 
agg=true)', () => {

-- 
To view, visit https://gerrit.wikimedia.org/r/389876
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I196429595a1a21099a812edb709de00b7a617098
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to