From 8b82d23cdf70d54bf44d24b3f83cce16adfde17c Mon Sep 17 00:00:00 2001 From: kent Date: Sun, 21 Dec 2025 03:46:16 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[flow-tester]=20ResponseValidator?= =?UTF-8?q?=EC=97=90=20@isObject=20=EC=97=B0=EC=82=B0=EC=9E=90=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JSON 응답에서 객체(연관 배열) 타입을 검증하는 @isObject 연산자 구현 - array_is_list()로 순차 배열과 연관 배열 구분 - $.user 등 객체 필드 검증 시 사용 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app/Services/FlowTester/ResponseValidator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Services/FlowTester/ResponseValidator.php b/app/Services/FlowTester/ResponseValidator.php index c1f2a869..b55cefd9 100644 --- a/app/Services/FlowTester/ResponseValidator.php +++ b/app/Services/FlowTester/ResponseValidator.php @@ -13,6 +13,7 @@ * - @isNumber: 숫자 타입 체크 * - @isString: 문자열 타입 체크 * - @isArray: 배열 타입 체크 + * - @isObject: 객체(연관 배열) 타입 체크 * - @isBoolean: 불리언 타입 체크 * - @minLength:N: 최소 길이 (배열/문자열) * - @maxLength:N: 최대 길이 (배열/문자열) @@ -119,6 +120,7 @@ private function validateValue(mixed $actual, mixed $expected, string $path): ?s $operator === 'isString' => ! is_string($actual) ? "Path {$path}: expected string, got ".gettype($actual) : null, $operator === 'isArray' => ! is_array($actual) ? "Path {$path}: expected array, got ".gettype($actual) : null, $operator === 'isBoolean' => ! is_bool($actual) ? "Path {$path}: expected boolean, got ".gettype($actual) : null, + $operator === 'isObject' => ! is_array($actual) || array_is_list($actual) ? "Path {$path}: expected object, got ".(is_array($actual) ? 'array' : gettype($actual)) : null, $operator === 'isNull' => $actual !== null ? "Path {$path}: expected null, got ".gettype($actual) : null, $operator === 'notNull' => $actual === null ? "Path {$path}: expected not null" : null, $operator === 'isEmpty' => ! empty($actual) ? "Path {$path}: expected empty" : null,