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

Is it possible to type-check the root?

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php
領域
api, testing-qa

調査の方向性

まず JsonType チェッカーと既存の REST レスポンスアサーションを読みます。ルートがインデックス付き配列であるレスポンスを対象に、提案されているエントリポイント seeJsonResponseLengthIs(int $number) を定義し、レスポンス要素数を検証し、インデックス付き配列ではないルートを拒否することを示すカバレッジを追加します。

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

説明

My main intent is to make sure the response contains the number of elements I expect.

My current flow is to grab the json_decoded response and use PHPUnit asserts for that... but it seems suboptimal.
Then I decided to see the JsonType checker, but even by adding a custom filter (for array/string length) it doesn't really help as I can't type-check the actual root as an array - just its entries.

Unfortunately, the API I'm testing doesn't have a root key (i.e. $.data), the list is directly returned (e.g. [ { user_id: x }, { user_id: y } ]).

I see I can't use the JsonType matcher by design, and changing that could be a breaking change, or an extra argument... Doesn't seem the best?
I wonder if this is such an edge case that I should only care to write something on my own, or if I could submit a PR of something like seeJsonResponseLengthIs(int $number). It would check the response is an indexed array, and then count it.

主要言語
PHP
スター
60
フォーク
30
平均マージ
22時間 37分
マージ済み PR(30日)
1

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

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

はじめの一歩

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

Codeception/module-rest のほかの issue

Codeception/module-rest の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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