Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Resource.get(query) receives a RequestTarget: plain property access is silently undefined

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

メンテナーはふだん 2 日以内に返信

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

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
90/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, typescript
領域
documentation

調査の方向性

get(query) について説明されている reference/resources/resource-api.md から始め、次に resources/RequestTarget.ts で直接宣言されている framework プロパティを確認します。既存の target.get('param1') の例をコンテキストとして使用します。reference が RequestTarget が URLSearchParams を拡張していることを明示し、カスタムパラメーターには query.get('name') を使用し、単純なプロパティへのアクセスでは undefined になることを説明し、直接のプロパティを列挙していれば完了です。

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

説明

Document that a custom Resource.get(query) receives a RequestTarget, so plain property access is silently undefined

The trap

In a custom Resource handler, query is a RequestTarget, which extends URLSearchParams:

static async get(query) {
  const ids = query.ids;         // undefined, always, for a custom param
  const ids = query.get('ids');  // correct
}

resources/RequestTarget.ts:5 — class RequestTarget extends URLSearchParams — declares only a
fixed set of framework properties (conditions, limit, select, sort, … ~:24-100). Arbitrary
query parameters are never assigned as own properties: resources/search.ts:1370's
NEEDS_PARSER = /[()[\]|!<>.]|(=\w*=)/ gates the FIQL parser, so a plain ?ids=1,2,3 (no special
characters) takes parseQuery's else branch (search.ts:1381-1406) and simply returns query
untouched.

So query.ids is undefined and there is no error — the handler quietly behaves as if the caller
sent nothing.

Why it's worth a doc callout rather than a code change

It fails silently, and it fails the same way for everyone writing their first custom Resource. It
already bit our own QA fixture: a DirectHistory test resource read query.ids and the bug stayed
invisible only because that parameter's value happened to equal the handler's default.

HarperFast/documentation reference/resources/resource-api.md:67 already shows the right form
(target.get('param1')) in an example, but nowhere states that the plain-property form silently
yields undefined. An example a reader can copy correctly is not the same as a warning a reader can
avoid; the failure mode needs naming.

Ask

In the resource-api reference, where get(query) is described:

  1. State that query is a RequestTarget extends URLSearchParams.
  2. State that custom query parameters must be read with query.get('name'), and that plain property
    access returns undefined without error.
  3. Note which properties are available directly (the declared framework set: conditions, limit,
    select, sort, …), so the distinction is learnable rather than a rule to memorize.
Not this

HarperFast/harper#135 ("A target should have parsed query properties in static REST methods") is
CLOSED (2026-04-15, PR #124 "Immediately parse search/queries in URLs provided to RequestTarget").
That fix made the declared special-purpose properties parse eagerly in the constructor; it never
made arbitrary custom parameter names land as own properties, and was not intended to. So this is not
covered by #135's closure — re-verified on main 6d725818c.

— Claude Opus 5.5

主要言語
MDX
スター
9
フォーク
9
平均マージ
1日 20時間
マージ済み PR(30日)
16

環境構築

はじめの一歩

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

HarperFast/documentation のほかの issue

HarperFast/documentation の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

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

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