Ver Fonte

add schemas for offset and limit

Yuki Takei há 10 meses atrás
pai
commit
3fdd6a599a

+ 12 - 8
apps/app/src/server/models/openapi/paginate-result.ts

@@ -4,6 +4,14 @@
  *
  *
  *  components:
  *  components:
  *    schemas:
  *    schemas:
+ *      Offset:
+ *        description: Offset for pagination
+ *        type: integer
+ *        example: 0
+ *      Limit:
+ *        description: Limit for pagination
+ *        type: integer
+ *        example: 10
  *      PaginateResult:
  *      PaginateResult:
  *        description: PaginateResult
  *        description: PaginateResult
  *        type: object
  *        type: object
@@ -17,8 +25,7 @@
  *            type: number
  *            type: number
  *            description: Total number of documents in collection that match a query
  *            description: Total number of documents in collection that match a query
  *          limit:
  *          limit:
- *            type: number
- *            description: Limit that was used
+ *            $ref: '#/components/schemas/Limit'
  *          hasPrevPage:
  *          hasPrevPage:
  *            type: number
  *            type: number
  *            description: Availability of prev page.
  *            description: Availability of prev page.
@@ -32,8 +39,8 @@
  *            type: number
  *            type: number
  *            description: Total number of pages.
  *            description: Total number of pages.
  *          offset:
  *          offset:
- *            type: number
  *            description: Only if specified or default page/offset values were used
  *            description: Only if specified or default page/offset values were used
+ *            $ref: '#/components/schemas/Offset'
  *          prefPage:
  *          prefPage:
  *            type: number
  *            type: number
  *            description: Previous page number if available or NULL
  *            description: Previous page number if available or NULL
@@ -66,13 +73,10 @@
  *                description: Total number of documents in collection that match a query
  *                description: Total number of documents in collection that match a query
  *                example: 35
  *                example: 35
  *              limit:
  *              limit:
- *                type: integer
- *                description: Limit that was used
- *                example: 10
+ *                $ref: '#/components/schemas/Limit'
  *              offset:
  *              offset:
- *                type: integer
  *                description: Only if specified or default page/offset values were used
  *                description: Only if specified or default page/offset values were used
- *                example: 20
+ *                $ref: '#/components/schemas/Offset'
  *          data:
  *          data:
  *            type: object
  *            type: object
  *            description: Object of pagination meta data.
  *            description: Object of pagination meta data.

+ 2 - 2
apps/app/src/server/routes/search.ts

@@ -66,11 +66,11 @@ module.exports = function(crowi: Crowi, app) {
    *         - in: query
    *         - in: query
    *           name: offset
    *           name: offset
    *           schema:
    *           schema:
-   *             $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/offset'
+   *             $ref: '#/components/schemas/Offset'
    *         - in: query
    *         - in: query
    *           name: limit
    *           name: limit
    *           schema:
    *           schema:
-   *             $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/limit'
+   *             $ref: '#/components/schemas/Limit'
    *       responses:
    *       responses:
    *         200:
    *         200:
    *           description: Succeeded to get list of pages.
    *           description: Succeeded to get list of pages.

+ 2 - 2
apps/app/src/server/routes/tag.js

@@ -186,11 +186,11 @@ module.exports = function(crowi, app) {
    *          - in: query
    *          - in: query
    *            name: limit
    *            name: limit
    *            schema:
    *            schema:
-   *              $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/limit'
+   *              $ref: '#/components/schemas/Limit'
    *          - in: query
    *          - in: query
    *            name: offset
    *            name: offset
    *            schema:
    *            schema:
-   *              $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/offset'
+   *              $ref: '#/components/schemas/Offset'
    *        responses:
    *        responses:
    *          200:
    *          200:
    *            description: Succeeded to tag list.
    *            description: Succeeded to tag list.