Skip to content

APIのGet pageのレスポンスの形式が、OpenAPIの情報と実装で異なる #10416

@onozaty

Description

@onozaty

Environment

Host

item version
OS
GROWI 7.3.3
node.js
npm
Using Docker yes
Using growi-docker-compose yes

(Accessing https://{GROWI_HOST}/admin helps you to fill in above versions)

Client

item version
OS Debian GNU/Linux 12
browser

How to reproduce? (再現手順)

ページ情報取得(Get page)のAPIを叩きます。

node@524ed323b12c:/workspaces/growi-uploader$ curl -X GET "http://growi:3000/_api/v3/page?path=/sample/curl-test" \
  -H "Authorization: Bearer i8WFM7ELzz5KFV8OCK9SKZ886ReaiUJ8N3V2mAGaeGg=" \
  | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1428  100  1428    0     0  38153      0 --:--:-- --:--:-- --:--:-- 38594
{
  "page": {
    "_id": "68f37362794f665ad2c0c6e8",
    "parent": "68f331d3794f665ad2c0b9ce",
    "descendantCount": 0,
    "isEmpty": false,
    "status": "published",
    "grant": 1,
    "grantedUsers": [],
    "liker": [],
    "seenUsers": [],
    "commentCount": 0,
    "grantedGroups": [],
    "updatedAt": "2025-10-18T11:00:50.700Z",
    "path": "/sample/curl-test",
    "creator": {
      "_id": "68efa5fe3e507918f95fae89",
      "isGravatarEnabled": false,
      "isEmailPublished": true,
      "lang": "ja_JP",
      "status": 2,
      "admin": true,
      "name": "admin",
      "username": "admin",
      "email": "[email protected]",
      "createdAt": "2025-10-15T13:47:42.776Z",
      "imageUrlCached": "/images/icons/user.svg"
    },
    "lastUpdateUser": {
      "_id": "68efa5fe3e507918f95fae89",
      "isGravatarEnabled": false,
      "isEmailPublished": true,
      "lang": "ja_JP",
      "status": 2,
      "admin": true,
      "name": "admin",
      "username": "admin",
      "email": "[email protected]",
      "createdAt": "2025-10-15T13:47:42.776Z",
      "imageUrlCached": "/images/icons/user.svg"
    },
    "createdAt": "2025-10-18T11:00:50.696Z",
    "__v": 0,
    "latestRevisionBodyLength": 29,
    "revision": {
      "_id": "68f37362794f665ad2c0c6ec",
      "format": "markdown",
      "pageId": "68f37362794f665ad2c0c6e8",
      "body": "# Curl Test\n\nCreated via curl",
      "author": {
        "_id": "68efa5fe3e507918f95fae89",
        "isGravatarEnabled": false,
        "isEmailPublished": true,
        "lang": "ja_JP",
        "status": 2,
        "admin": true,
        "name": "admin",
        "username": "admin",
        "email": "[email protected]",
        "createdAt": "2025-10-15T13:47:42.776Z",
        "imageUrlCached": "/images/icons/user.svg"
      },
      "createdAt": "2025-10-18T11:00:50.698Z",
      "__v": 0
    },
    "id": "68f37362794f665ad2c0c6e8"
  }
}

What happens? (症状)

http://growi:3000/_api/v3/page?path=/sample/curl-test のような形でAPIを叩いた際に、返却されるレスポンスの形式がOpenAPIの情報と異なっているようです。

OpenAPIの仕様では下記のようになっています。

OpenAPIでの定義
{
  "_id": "5ae5fccfc5577b0004dbd8ab",
  "__v": 0,
  "commentCount": 3,
  "createdAt": "2010-01-01T00:00:00.000Z",
  "creator": {
    "_id": "5ae5fccfc5577b0004dbd8ab",
    "lang": "en_US",
    "status": 0,
    "admin": false,
    "email": "[email protected]",
    "username": "alice",
    "name": "Alice",
    "createdAt": "2010-01-01T00:00:00.000Z",
    "imageUrlCached": "/images/user/5ae5fccfc5577b0004dbd8ab/profile.jpg",
    "isEmailPublished": false,
    "isGravatarEnabled": false,
    "isInvitationEmailSended": false,
    "lastLoginAt": "2010-01-01T00:00:00.000Z",
    "readOnly": false,
    "updatedAt": "2010-01-01T00:00:00.000Z",
    "__v": 0
  },
  "extended": {},
  "grant": 1,
  "grantedUsers": [
    "5ae5fccfc5577b0004dbd8ab"
  ],
  "lastUpdateUser": {
    "_id": "5ae5fccfc5577b0004dbd8ab",
    "lang": "en_US",
    "status": 0,
    "admin": false,
    "email": "[email protected]",
    "username": "alice",
    "name": "Alice",
    "createdAt": "2010-01-01T00:00:00.000Z",
    "imageUrlCached": "/images/user/5ae5fccfc5577b0004dbd8ab/profile.jpg",
    "isEmailPublished": false,
    "isGravatarEnabled": false,
    "isInvitationEmailSended": false,
    "lastLoginAt": "2010-01-01T00:00:00.000Z",
    "readOnly": false,
    "updatedAt": "2010-01-01T00:00:00.000Z",
    "__v": 0
  },
  "liker": [],
  "path": "/path/to/page",
  "revision": "string",
  "seenUsers": [
    "5ae5fccfc5577b0004dbd8ab"
  ],
  "status": "published",
  "updatedAt": "2010-01-01T00:00:00.000Z"
}

実際に返されるレスポンスでは、pageというプロパティを挟んでいました。

レスポンスの情報
{
  "page": {
    "_id": "68f37362794f665ad2c0c6e8",
    "parent": "68f331d3794f665ad2c0b9ce",
    "descendantCount": 0,
    "isEmpty": false,
    "status": "published",
    "grant": 1,
    "grantedUsers": [],
    "liker": [],
    "seenUsers": [],
    "commentCount": 0,
    "grantedGroups": [],
    "updatedAt": "2025-10-18T11:00:50.700Z",
    "path": "/sample/curl-test",
    "creator": {
      "_id": "68efa5fe3e507918f95fae89",
      "isGravatarEnabled": false,
      "isEmailPublished": true,
      "lang": "ja_JP",
      "status": 2,
      "admin": true,
      "name": "admin",
      "username": "admin",
      "email": "[email protected]",
      "createdAt": "2025-10-15T13:47:42.776Z",
      "imageUrlCached": "/images/icons/user.svg"
    },
    "lastUpdateUser": {
      "_id": "68efa5fe3e507918f95fae89",
      "isGravatarEnabled": false,
      "isEmailPublished": true,
      "lang": "ja_JP",
      "status": 2,
      "admin": true,
      "name": "admin",
      "username": "admin",
      "email": "[email protected]",
      "createdAt": "2025-10-15T13:47:42.776Z",
      "imageUrlCached": "/images/icons/user.svg"
    },
    "createdAt": "2025-10-18T11:00:50.696Z",
    "__v": 0,
    "latestRevisionBodyLength": 29,
    "revision": {
      "_id": "68f37362794f665ad2c0c6ec",
      "format": "markdown",
      "pageId": "68f37362794f665ad2c0c6e8",
      "body": "# Curl Test\n\nCreated via curl",
      "author": {
        "_id": "68efa5fe3e507918f95fae89",
        "isGravatarEnabled": false,
        "isEmailPublished": true,
        "lang": "ja_JP",
        "status": 2,
        "admin": true,
        "name": "admin",
        "username": "admin",
        "email": "[email protected]",
        "createdAt": "2025-10-15T13:47:42.776Z",
        "imageUrlCached": "/images/icons/user.svg"
      },
      "createdAt": "2025-10-18T11:00:50.698Z",
      "__v": 0
    },
    "id": "68f37362794f665ad2c0c6e8"
  }
}

What is the expected result? (期待される動作)

  • OpenAPIの情報が、実装と一致していること

Note

素晴らしいツールをありがとうございます。

今回の問題は、OpenAPIの情報からクライアントを生成してページ更新を行うようなコードを書いていたところ、うまく動かない箇所があり気が付きました。
とりあえず実装にあわせて直して回避しているので、すぐに直っていないと困るというものではございません。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions