[Schema Inaccuracy] pull-request-review.state and two siblings should be enum, not string

オープン 初心者向け
#6,345 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
openapi
領域
api

調査の方向性

まずコンポーネントスキーマ pull-request-review.state、timeline-reviewed-event.state、webhooks_review.state を見つけ、ドキュメント化された API の値および inline の webhook-pull-request-review-dismissed.review.state の前例と比較します。REST スキーマに 5 つの大文字の値が列挙され、timeline スキーマと共有 webhook スキーマに 4 つの小文字の submitted-review 値が列挙されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

documentation

Schema Inaccuracy

Three schemas type their review state property as a plain string rather than an enum, even though the value is constrained to a documented set.

REST (uppercase values):

  1. components/schemas/pull-request-review.state{ "type": "string", "example": "CHANGES_REQUESTED" }. Used by GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews and every other endpoint returning a review.

Event records (lowercase values):

  1. components/schemas/timeline-reviewed-event.state{ "type": "string", "example": "CHANGES_REQUESTED" }. Returned by GET /repos/{owner}/{repo}/issues/{issue_number}/timeline. The example value here is uppercase, but the live API returns lowercase for this surface (see Reproduction below).
  2. components/schemas/webhooks_review.state{ "type": "string" }, $ref'd from webhook-pull-request-review-submitted.review and -edited.review. Webhook payloads deliver lowercase.

The canonical value list is GitHub's own GraphQL PullRequestReviewState enum: APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED, PENDING. Prior precedent for citing the GraphQL enum as the source of truth: #74 (author_association), which was resolved by introducing a shared author-association component schema with the enum drawn from the GraphQL CommentAuthorAssociation enum.

Expected

pull-request-review.state (REST) should enumerate the uppercase values the API returns:

"state": {
  "type": "string",
  "enum": ["APPROVED", "CHANGES_REQUESTED", "COMMENTED", "DISMISSED", "PENDING"],
  "example": "CHANGES_REQUESTED"
}

timeline-reviewed-event.state and webhooks_review.state should enumerate the lowercase values these surfaces actually deliver (pending is omitted because reviews don't reach event records or webhook payloads until submitted):

"state": {
  "type": "string",
  "enum": ["approved", "changes_requested", "commented", "dismissed"]
}

The inline webhook-pull-request-review-dismissed.review.state already declares the enum ["dismissed", "approved", "changes_requested"] directly — precedent for the same fix on webhooks_review.state.

Reproduction Steps

REST pull-request-review.state returns uppercase:

$ curl -s -H "Accept: application/vnd.github+json" \
    -H "X-GitHub-Api-Version: 2022-11-28" \
    https://api.github.com/repos/kubernetes/kubernetes/pulls/90000/reviews \
    | jq '[.[].state] | unique'
[
  "APPROVED",
  "CHANGES_REQUESTED",
  "COMMENTED"
]

timeline-reviewed-event.state returns lowercase from the same PR (despite the spec's uppercase example: "CHANGES_REQUESTED"):

$ curl -s -H "Accept: application/vnd.github+json" \
    -H "X-GitHub-Api-Version: 2022-11-28" \
    https://api.github.com/repos/kubernetes/kubernetes/issues/90000/timeline \
    | jq -r '[.[] | select(.event == "reviewed") | .state] | unique'
[
  "approved",
  "changes_requested",
  "commented"
]
主要言語
言語のデータがありません
スター
1.6k
フォーク
342
平均マージ
3時間 33分
マージ済み PR(30日)
51

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/rest-api-description のほかの issue

github/rest-api-description の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。