Explorar el Código

Merge pull request #10787 from growilabs/copilot/handle-user-requests

fix: OpenAPI spec mismatch for GET /page endpoint response format
mergify[bot] hace 1 mes
padre
commit
b936806a95

+ 19 - 0
apps/app/src/server/models/openapi/page.ts

@@ -7,6 +7,25 @@
  *        description: Page path
  *        type: string
  *        example: /path/to/page
+ *      GetPageResponse:
+ *        description: Response for GET /page endpoint
+ *        type: object
+ *        properties:
+ *          page:
+ *            allOf:
+ *              - $ref: '#/components/schemas/Page'
+ *              - description: The requested page. Null if pages array is returned instead.
+ *            nullable: true
+ *          pages:
+ *            type: array
+ *            items:
+ *              $ref: '#/components/schemas/Page'
+ *            description: Array of pages when findAll parameter is used. Null otherwise.
+ *            nullable: true
+ *          meta:
+ *            type: object
+ *            description: Metadata about the page request
+ *            nullable: true
  *      PageGrant:
  *        description: Grant for page
  *        type: number

+ 22 - 2
apps/app/src/server/routes/apiv3/page/index.ts

@@ -161,7 +161,7 @@ module.exports = (crowi: Crowi) => {
    *      get:
    *        tags: [Page]
    *        summary: Get page
-   *        description: get page by pagePath or pageId
+   *        description: Get page by pagePath or pageId. Returns a single page or multiple pages based on parameters.
    *        parameters:
    *          - name: pageId
    *            in: query
@@ -173,13 +173,33 @@ module.exports = (crowi: Crowi) => {
    *            description: page path
    *            schema:
    *              $ref: '#/components/schemas/PagePath'
+   *          - name: findAll
+   *            in: query
+   *            description: If set, returns all pages matching the path (returns pages array instead of single page)
+   *            schema:
+   *              type: boolean
+   *          - name: revisionId
+   *            in: query
+   *            description: Specific revision ID to retrieve
+   *            schema:
+   *              $ref: '#/components/schemas/ObjectId'
+   *          - name: shareLinkId
+   *            in: query
+   *            description: Share link ID for shared page access
+   *            schema:
+   *              $ref: '#/components/schemas/ObjectId'
+   *          - name: includeEmpty
+   *            in: query
+   *            description: Include empty pages in results when using findAll
+   *            schema:
+   *              type: boolean
    *        responses:
    *          200:
    *            description: Page data
    *            content:
    *              application/json:
    *                schema:
-   *                  $ref: '#/components/schemas/Page'
+   *                  $ref: '#/components/schemas/GetPageResponse'
    */
   router.get(
     '/',