From 652348b2f30d871616b896f7719ec8ba17a089b1 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko Date: Tue, 4 Jun 2024 16:15:53 +0300 Subject: [PATCH] more sensible defaults so data_get can work based on given path --- src/OpenApiTraverser.php | 2 +- tests/OpenApiTraverserTest.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/OpenApiTraverser.php b/src/OpenApiTraverser.php index 4fa297dd..811fca3a 100644 --- a/src/OpenApiTraverser.php +++ b/src/OpenApiTraverser.php @@ -9,7 +9,7 @@ public function __construct( ) { } - public function traverse($type, $path = ['#']): void + public function traverse($type, $path = []): void { if (is_scalar($type) || $type === null) { return; diff --git a/tests/OpenApiTraverserTest.php b/tests/OpenApiTraverserTest.php index 94daced8..15a9fd4c 100644 --- a/tests/OpenApiTraverserTest.php +++ b/tests/OpenApiTraverserTest.php @@ -27,10 +27,10 @@ public function enter($object, $path = []) $traverser->traverse($document); expect($visitor->paths)->toBe([ - '#', - '#.info', - '#.components', - '#.paths.0', - '#.paths.0.operations.GET', + '', + 'info', + 'components', + 'paths.0', + 'paths.0.operations.GET', ]); });