feat: [flow-tester] ResponseValidator에 @isObject 연산자 추가
JSON 응답에서 객체(연관 배열) 타입을 검증하는 @isObject 연산자 구현 - array_is_list()로 순차 배열과 연관 배열 구분 - $.user 등 객체 필드 검증 시 사용 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
* - @isNumber: 숫자 타입 체크
|
* - @isNumber: 숫자 타입 체크
|
||||||
* - @isString: 문자열 타입 체크
|
* - @isString: 문자열 타입 체크
|
||||||
* - @isArray: 배열 타입 체크
|
* - @isArray: 배열 타입 체크
|
||||||
|
* - @isObject: 객체(연관 배열) 타입 체크
|
||||||
* - @isBoolean: 불리언 타입 체크
|
* - @isBoolean: 불리언 타입 체크
|
||||||
* - @minLength:N: 최소 길이 (배열/문자열)
|
* - @minLength:N: 최소 길이 (배열/문자열)
|
||||||
* - @maxLength: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 === '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 === '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 === '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 === 'isNull' => $actual !== null ? "Path {$path}: expected null, got ".gettype($actual) : null,
|
||||||
$operator === 'notNull' => $actual === null ? "Path {$path}: expected not null" : null,
|
$operator === 'notNull' => $actual === null ? "Path {$path}: expected not null" : null,
|
||||||
$operator === 'isEmpty' => ! empty($actual) ? "Path {$path}: expected empty" : null,
|
$operator === 'isEmpty' => ! empty($actual) ? "Path {$path}: expected empty" : null,
|
||||||
|
|||||||
Reference in New Issue
Block a user