swagger: '2.0'
info:
  version: '1.0.0'
  title: MediaWiki Content API
  description: Basic MediaWiki content api.
  termsofservice: https://github.com/wikimedia/restbase#restbase
  contact:
    name: Services
    email: services@lists.wikimedia.org
    url: https://www.mediawiki.org/wiki/Services
  license:
    name: Apache licence, v2
    url: https://www.apache.org/licenses/LICENSE-2.0
tags:
  - name: Page content
    description: page content in different formats
paths:
  /:
    get:
      tags:
        - Page content
      summary: List page-related API entry points.
      description: |
        Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)
      produces:
        - application/json
      responses:
        '200':
          description: A list of page-related API end points.
          schema:
            $ref: '#/definitions/listing'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      x-monitor: false

  /title/{title}{/revision}:
    get:
      tags:
        - Page content
      summary: Get revision metadata for a title.
      description: |
        Returns the revision metadata for the given title. If a revision ID is provided,
        metadata for that revision is returned, otherwise the latest revision ID is assumed.

        Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable).
      produces:
        - application/json
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: revision
          in: path
          description: The revision id
          type: integer
          required: false
      responses:
        '200':
          description: The latest revision metadata for the provided title.
          schema:
            $ref: '#/definitions/revision'
        '301':
          description: |
            A permanent redirect is returned if the supplied article title was not in the normalized form.
            To avoid these redirects, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform
            title normalization client side.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '302':
          description: |
            The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).
            The `location` header points to the redirect target.
            If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '404':
          description: Unknown page title or no revisions found.
          schema:
            $ref: '#/definitions/problem'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      x-request-handler:
        - get_from_backend:
            request:
              uri: /{domain}/sys/page_revisions/page/{title}{/revision}
              headers:
                # FIXME: Temporary work-around (see T120212).
                cache-control: 'no-cache'
                if-unmodified-since: '{{if-unmodified-since}}'
      x-monitor: true
      x-amples:
        - title: Get rev by title from storage
          request:
            params:
              domain: en.wikipedia.org
              title: User:BSitzmann_(WMF)/MCS/Test/Frankenstein
          response:
            status: 200
            headers:
              etag: /.+/
              content-type: application/json
            body:
              items:
                - title: 'User:BSitzmann_(WMF)/MCS/Test/Frankenstein'
                  rev: /\d+/
                  tid: /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
                  comment: /.*/

  /html/{title}:
    x-route-filters:
      - path: ./lib/revision_table_access_check_filter.js
        options:
          redirect_cache_control: '{{options.response_cache_control}}'
          attach_body_to_redirect: true
      - path: lib/security_response_header_filter.js
        options:
          allowInlineStyles: true
    get:
      x-route-filters:
        - path: lib/ensure_content_type.js
      tags:
        - Page content
      summary: Get latest HTML for a title.
      description: |
        Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: sections
          in: query
          description: Comma-separated list of section IDs.
          type: string
        - name: redirect
          in: query
          description: >
            Requests for [redirect pages](https://www.mediawiki.org/wiki/Help:Redirects)
            return HTTP 302 with a redirect target in `Location` header and content in the body.

            To get a 200 response instead, supply `false` to the `redirect` parameter.
          type: boolean
          required: false
      produces:
        - text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.6.0"
        - application/json
      responses:
        '200':
          description: |
            The latest HTML for the given page title.

            See [the MediaWiki DOM
            spec](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec) for a
            description of the MediaWiki-specific semantic markup in this HTML.
            Note that additional metadata is available in the HTML head.
          schema:
            type: string
          headers:
            ETag:
              description: |
                ETag header indicating the revision and render timeuuid
                separated by a slash:
                "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc"
                This ETag can be passed to the HTML save end point (as
                `base_etag` POST parameter), and can also be used to retrieve
                the exact corresponding data-parsoid metadata, by requesting
                the specific `revision` and `tid` indicated by the `ETag`.
              type: string
        '301':
          description: |
            A permanent redirect is returned if the supplied article title was not in the normalized form.
            To avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform
            title normalization client-side.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '302':
          description: |
            The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).
            The `location` header points to the redirect target, and the body contains the actual page contents as HTML.
            If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '404':
          description: Unknown page title
          schema:
            $ref: '#/definitions/problem'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      x-request-handler:
        - get_from_backend:
            request:
              # Directly return the latest HTML. Alternatively, we could also try
              # relative redirects. A relative location header of 'foo/bar' seems to
              # work in current Chrome and Firefox.
              # See also http://tools.ietf.org/html/rfc7231#section-7.1.2
              uri: /{domain}/sys/parsoid/html/{title}
              headers:
                cache-control: '{{cache-control}}'
                if-unmodified-since: '{{if-unmodified-since}}'
                x-restbase-mode: '{{x-restbase-mode}}'
                x-restbase-parentrevision: '{{x-restbase-parentrevision}}'
              query:
                sections: '{{sections}}'
      x-monitor: true
      x-amples:
        # FIXME: This depends on our 'no change' detection optimization to
        # avoid filling up storage with re-renders. We have plenty of data on
        # Parsoid backend requests, so there shouldn't be a need to test this
        # per-instance.
        #- title: Get html by title from Parsoid
        #  request:
        #    params:
        #      title: Foobar
        #    headers:
        #      cache-control: no-cache
        #  response:
        #    status: 200
        #    headers:
        #      etag: /.+/
        #      content-type: /^text\/html.+/
        #    body: /^<!DOCTYPE html>.*/
        - title: Get html by title from storage
          request:
            params:
              domain: en.wikipedia.org
              title: User:BSitzmann_(WMF)/MCS/Test/Frankenstein
          response:
            status: 200
            headers:
              etag: /.+/
              content-type: /^text\/html.+/
            body: /^<!DOCTYPE html>.*/
    post:
      tags:
        - Page content
      summary: Save a new revision using HTML.
      description: |
        Save a new revision of a page given in [Parsoid
        HTML](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec)
        format.

        For new pages, or when editting the latest revision of a page,
        the `base_etag` parameter should be left empty. For editing old revisions,
        it should contain the `ETag` header of the revision the edit is derived from.

        The latest page revision ETag header could be provided in the If-Match header
        to detect edit conflicts. If the new page is created, appropriate user cookies
        must be provided.

        Stability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: base_etag
          in: formData
          description: >
            ETag header of the revision the edit is based on. Should be
            supplied for all existing pages to ensure clean round-tripping.
          type: string
          required: false
        - name: html
          in: formData
          description: HTML of the page to save.
          type: string
          required: true
          x-textarea: true
        - name: csrf_token
          in: formData
          description: CSRF edit token provided by the MW API.
          type: string
          required: true
        - name: comment
          in: formData
          description: Comment summarizing the change.
          type: string
          required: false
        - name: is_minor
          in: formData
          description: Flag indicating a minor change.
          type: boolean
          required: false
        - name: is_bot
          in: formData
          description: Flag indicating a bot edit.
          type: boolean
          required: false
      consumes:
        - multipart/form-data
      produces:
        - application/json
      responses:
        '200':
          description: The content was not changed, and no new version was created.
          schema:
            type: object
            # FIXME: document
        '201':
          description: A new revision of the page has been created
          headers:
            ETag:
              description: |
                ETag header indicating the new revision and timeuuid,
                separated by a slash:
                "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc"
              type: string
        '400':
          description: Invalid request - lack of required parameters, bad ETags etc.
          schema:
            $ref: '#/definitions/problem'
        '409':
          description: Edit conflict
          schema:
            $ref: '#/definitions/problem'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      # RB doesn't check for permissions, just prepares a request correctly
      x-route-filters:
        - path: ./lib/mediawiki_auth_filter.js
      x-request-handler:
        - post_to_backend:
            request:
              uri: /{domain}/sys/page_save/html/{title}
              headers: '{{request.headers}}'
              body: '{{request.body}}'
      x-monitor: false

  /html/{title}/:
    get:
      tags:
        - Page content
      summary: List HTML revisions for a title.
      description: |
        This currently only lists revisions that are already stored in RESTBase.

        Stability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)
      produces:
        - application/json
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: page
          in: query
          description: The next page token, provided by _links.next.href property.
          type: string
          required: false
      responses:
        '200':
          description: A list of revisions for the given title.
          schema:
            $ref: '#/definitions/revisions'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      x-request-handler:
        - get_from_backend:
            request:
              uri: /{domain}/sys/parsoid/html/{title}/
              headers:
                cache-control: '{{cache-control}}'
                if-unmodified-since: '{{if-unmodified-since}}'
                x-restbase-mode: '{{x-restbase-mode}}'
                x-restbase-parentrevision: '{{x-restbase-parentrevision}}'
              query:
                page: '{{page}}'
      x-monitor: false

  /html/{title}/{revision}{/tid}:
    x-route-filters:
      - path: ./lib/revision_table_access_check_filter.js
        options:
          redirect_cache_control: '{{options.response_cache_control}}'
          attach_body_to_redirect: true
      - path: lib/security_response_header_filter.js
        options:
          allowInlineStyles: true
    get:
      x-route-filters:
        - path: lib/ensure_content_type.js
      tags:
        - Page content
      summary: Get HTML for a specific title/revision & optionally timeuuid.
      description: |
        Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)
      operationId: getFormatRevision
      produces:
        - text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.6.0"
        - application/json
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: revision
          in: path
          description: The revision
          type: integer
          required: true
        - name: tid
          in: path
          description: The revision's time ID
          type: string
        - name: sections
          in: query
          description: Comma-separated list of section IDs
          type: string
        - name: redirect
          in: query
          description: >
            Requests for [redirect pages](https://www.mediawiki.org/wiki/Help:Redirects)
            return HTTP 302 with a redirect target in `Location` header and content in the body.

            To get a 200 response instead, supply `false` to the `redirect` parameter.
          type: boolean
          required: false
      responses:
        '200':
          description: |
            The html for the given page, revision and tid.

            See [the MediaWiki DOM
            spec](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec) for a
            description of the MediaWiki-specific semantic markup in this HTML.
            Note that additional metadata is available in the HTML head.

            This HTML can be edited using arbitrary HTML tools. The modified HTML
            can be converted back to wikitext using the
            [/transform/html/to/wikitext{/title}{/revision}](#!/Transforms/transform_html_to_wikitext__title___revision__post)
            entry point.
          schema:
            oneOf:
              - type: string
              - type: object
                patternProperties:
                  '^mw\w+$': string
          headers:
            ETag:
              description: |
                ETag header indicating the revision and render timeuuid
                separated by a slash:
                "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc"
                This ETag can be passed to the HTML save end point (as
                `base_etag` POST parameter), and can also be used to retrieve
                the exact corresponding data-parsoid metadata, by requesting
                the specific `revision` and `tid` indicated by the `ETag`.
              type: string
        '301':
          description: |
            A permanent redirect is returned if the supplied article title was not in the normalized form.
            To avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform
            title normalization client-side.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '302':
          description: |
            The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).
            The `location` header points to the redirect target, and the body contains the actual page revision contents as HTML.
            If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '400':
          description: Invalid revision or tid
          schema:
            $ref: '#/definitions/problem'
        '403':
          description: Access to the specific revision is restricted
          schema:
            $ref: '#/definitions/problem'
        '404':
          description: Unknown page, revision or tid
          schema:
            $ref: '#/definitions/problem'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      x-request-handler:
        - get_from_backend:
            request:
              uri: /{domain}/sys/parsoid/html/{title}/{revision}{/tid}
              headers:
                cache-control: '{{cache-control}}'
                if-unmodified-since: '{{if-unmodified-since}}'
                x-restbase-mode: '{{x-restbase-mode}}'
                x-restbase-parentrevision: '{{x-restbase-parentrevision}}'
              query:
                sections: '{{sections}}'
      x-monitor: false

  /data-parsoid/{title}/{revision}/{tid}:
    x-route-filters:
      - path: ./lib/revision_table_access_check_filter.js
        options:
          redirect_cache_control: '{{options.response_cache_control}}'
          attach_body_to_redirect: true
    get:
      tags:
        - Page content
      summary: Get data-parsoid metadata for a specific title/revision/tid.
      description: |
        Data-parsoid is metadata used by
        [Parsoid](https://www.mediawiki.org/wiki/Parsoid) to support clean
        round-tripping conversions between HTML and Wikitext. Among other
        things, it contains the original Wikitext offsets of each HTML
        element, keyed by element ID. The format is unstable.

        The metadata in data-parsoid is specific to a specific HTML render.
        For this reason, you need to supply the exact `revision` and `tid` as
        provided in the `ETag` header of the HTML response.

        Stability: [Stable](https://www.mediawiki.org/wiki/API_versioning#Stable)
      produces:
        - application/json; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/data-parsoid/1.6.0"
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: revision
          in: path
          description: The revision
          type: integer
          required: true
        - name: tid
          in: path
          description: The revision's time ID
          type: string
          required: true
        - name: redirect
          in: query
          description: >
            Requests for [redirect pages](https://www.mediawiki.org/wiki/Help:Redirects)
            return HTTP 302 with a redirect target in `Location` header and content in the body.

            To get a 200 response instead, supply `false` to the `redirect` parameter.
          type: boolean
          required: false
      responses:
        '200':
          description: The latest Parsoid data for the given page
          schema:
            $ref: '#/definitions/data-parsoid'
          headers:
            ETag:
              description: 'Revision / tid: "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc"'
              type: string
        '301':
          description: |
            A permanent redirect is returned if the supplied article title was not in the normalized form.
            To avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform
            title normalization client-side.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '302':
          description: |
            The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).
            The `location` header points to the redirect target, and the body contains the actual data-parsoid for the redirect page.
            If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '400':
          description: Invalid revision
          schema:
            $ref: '#/definitions/problem'
        '403':
          description: Access to the specific revision is restricted
          schema:
            $ref: '#/definitions/problem'
        '404':
          description: Unknown page, revision or tid
          schema:
            $ref: '#/definitions/problem'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      x-request-handler:
        - get_from_backend:
            request:
              uri: /{domain}/sys/parsoid/data-parsoid/{title}/{revision}{/tid}
              headers:
                cache-control: '{{cache-control}}'
                if-unmodified-since: '{{if-unmodified-since}}'
                x-restbase-mode: '{{x-restbase-mode}}'
                x-restbase-parentrevision: '{{x-restbase-parentrevision}}'
      x-monitor: false

  /lint/{title}{/revision}:
    x-route-filters:
      - path: ./lib/revision_table_access_check_filter.js
        options:
          redirect_cache_control: '{{options.response_cache_control}}'
      - path: lib/security_response_header_filter.js
    get:
      tags:
        - Page content
      summary: Get the linter errors for a specific title/revision.
      description: |
        Stability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)
      produces:
        - application/json
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: revision
          in: path
          description: The revision
          type: integer
          required: false
      responses:
        '200':
          description: |
            The lint errors for the given page and optionally revision.

            See [the Linter extension docs](https://www.mediawiki.org/wiki/Extension:Linter) for more
            details.
          schema:
            - type: object
          headers:
        '301':
          description: |
            A permanent redirect is returned if the supplied article title was not in the normalized form.
            To avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform
            title normalization client-side.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '302':
          description: |
            The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).
            The `location` header points to the redirect target, and the body contains the actual page revision contents as HTML.
            If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.

            Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)
            will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).
        '400':
          description: Invalid revision or tid
          schema:
            $ref: '#/definitions/problem'
        '403':
          description: Access to the specific revision is restricted
          schema:
            $ref: '#/definitions/problem'
        '404':
          description: Unknown page, revision or tid
          schema:
            $ref: '#/definitions/problem'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      x-request-handler:
        - get_from_backend:
            request:
              uri: /{domain}/sys/parsoid/lint/{title}{/revision}
      x-monitor: false

  /wikitext/{title}:
    post:
      tags:
        - Page content
      summary: Save a new revision of a page using Wikitext.
      description: |
        For new pages, or when editting the latest revision of a page,
        the `base_etag` parameter should be left empty.
        For editing old revisions, it should contain the ETag header
        of the revision the edit is derived from.

        The latest page revision ETag header should be provided in the If-Match header
        to detect edit conflicts. If the new page is created, appropriate user cookies
        must be provided.

        Stability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)
      parameters:
        - name: title
          in: path
          description: "Page title. Use underscores instead of spaces. Example: `Main_Page`."
          type: string
          required: true
        - name: base_etag
          in: formData
          description: The ETag header of the revision the edit is based on.
          type: string
          required: false
        - name: wikitext
          in: formData
          description: The wikitext source of the page to save
          type: string
          required: true
          x-textarea: true
        - name: csrf_token
          in: formData
          description: The CRSF edit token provided by the MW API
          type: string
          required: true
        - name: comment
          in: formData
          description: The summary of the change
          type: string
          required: false
        - name: is_minor
          in: formData
          description: Whether this represents a minor change
          type: boolean
          required: false
        - name: is_bot
          in: formData
          description: Whether the change is being made by a bot
          type: boolean
          required: false
      consumes:
        - multipart/form-data
      produces:
        - application/json
      responses:
        '200':
          description: The existing revision of the page matches the sent text
        '201':
          description: A new revision of the page has been created
          schema:
            type: object
            # FIXME: document
          headers:
            ETag:
              description: |
                ETag header indicating the new revision and timeuuid,
                separated by a slash:
                "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc"
              type: string
        '400':
          description: Invalid request - lack of required parameters, bad ETags etc.
          schema:
            $ref: '#/definitions/problem'
        '409':
          description: Edit conflict
          schema:
            $ref: '#/definitions/problem'
        default:
          description: Error
          schema:
            $ref: '#/definitions/problem'
      # RB doesn't check for permissions, just prepares a request correctly
      x-route-filters:
        - path: ./lib/mediawiki_auth_filter.js
      x-request-handler:
        - post_to_backend:
            request:
              uri: /{domain}/sys/page_save/wikitext/{title}
              headers: '{{request.headers}}'
              body: '{{request.body}}'
      x-monitor: false


definitions:
  revisions:
    description: The result format for revision listing
    required:
      - items
    properties:
      items:
        type: array
        $ref: '#/definitions/revisionIdentifier'

  listing:
    description: The result format for listings
    required:
      - items
    properties:
      items:
        type: array
        items:
          type: string
      _links:
        type: object
        properties:
          next:
            type: object
            properties:
              href:
                type: string
                description: Relative link to next result page.

  data-parsoid:
    description: Result format for Parsoid data queries
    required:
      - counter
      - ids
    properties:
      counter:
        type: integer
        format: int32
      ids:
        type: object

  revision:
    description: Result format for revision items
    required:
      - count
      - items
    properties:
      count:
        type: integer
        format: int32
      items:
        type: array
        $ref: '#/definitions/revisionInfo'

  revisionInfo:
    description: Complete information about the revision
    properties:
      title:
        type: string
      page_id:
        type: integer
        format: int32
      rev:
        type: integer
        format: int32
      tid:
        type: string
      comment:
        type: string
      restrictions:
        type: array
        items:
          type: string
      tags:
        type: array
        items:
          type: string
      user_id:
        type: integer
        format: int32
      user_text:
        type: string
      timestamp:
        type: string
        format: date-time
      redirect:
        type: boolean

  revisionIdentifier:
    description: Unique revision identifier
    properties:
      revision:
        type: integer
        format: int32
      tid:
        type: string
