JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Misleading message: "Key is not included in URL"

オープン
#785 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

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

Type: Enhancement
主要言語
Ruby
スター
2.3k
フォーク
546
PR マージ指標
30日以内にマージされた PR はありません

説明

Great gem, but the error message "Key is not included in URL" seems misleading to me for some reasons.

I) It is not clear whar is meant by "key" (I would suggest "id").
II) The message references a concrete problem in the URL, a missing key, which might not be true (e.g. a wrong key might be the problem as well).
III) The error could have happened in the data section as well.
IV) This message is returned whenever something goes wrong with the id (e.g. wrong type of id field in the data section), see example

Example: The following patch request to the correct url (and id) might cause this error message due to an invalid data type (int) for id. It has nothing to do with a "not included" key in the url.

{
data: {
"type": "articles",
"id": 1,
"attributes": {
"title": "updated title"
}
}
}

The request is invalid because of the wrong type (int) for "id". It MUST be string (conforming to json api), and jsonapi-resources correctly refuses to process this request, but with this misleading error message.

Suggestion for this Message: "id field is invalid or does not match the id given in the URL."

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

調査の方向性

コードベースで正確なメッセージ "Key is not included in URL" を検索し、example payload によって実行される検証パスを追跡します。無効な整数 id のケースを再現し、その後、無効な id または一致しない id を説明するように文言を更新し、既存のテストで関連するリクエストの動作を確認します。

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

評価

技術スタック
rails, ruby
領域
api, backend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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